随笔分类 - php
摘要:php远程copy以及执行命令php远程copy文件以及在远程服务器中执行命令时,所用到的模块是ssh2,以后所有的操作都依据ssh2连接句柄完成。1. SSH2模块的安装1.1 安装需要的扩展包wget http://www.libssh2.org/download/libssh2-1.4.2.tar.gztar zxf libssh2-1.4.2.tar.gzcd libssh2-1.4.2./configure && make && make installwget http://pecl.php.net/get/ssh2-0.11.3.tgzcd ssh
阅读全文
摘要:1. 效果图2.代码<?phpif($_SERVER['PHP_AUTH_USER']=='user'&&$_SERVER['PHP_AUTH_PW']=='pw'){ echo('验证通过');}else{ header('WWW-Authenticate: Basic realm="user"'); header('HTTP/1.0 401 Unauthorized'); echo 'Unauthorized.';}?&g
阅读全文
摘要:function getIP(){ static $realip; if (isset($_SERVER)){ if (isset($_SERVER["HTTP_X_FORWARDED_FOR"])){ $realip = $_SERVER["HTTP_X_FORWARDED_FOR"]; } else if (isset($_SERVER["HTTP_CLIENT_IP"])) { $realip = $_SERVER["HTTP_CLIENT_IP"]; } else { ...
阅读全文
摘要:error_reporting(0);//所有的错误都不用系统定定义的function user_define_error_handle($errorNo, $errorMessage, $errorFile = __FILE__, $errorLine = __LINE__){ echo xml_error(903); write_log($errorNo.' '.$errorMessage.' '.$errorFile.' '.$errorLine); exit();}set_error_handler("user_define_e
阅读全文
摘要:Options +FollowSymLinksRewriteEngine OnRewriteBase /RewriteRule ^(.*)$ http://www.baidu.com/$1 [L,R=301]把根目录下面的所有访问都定向到百度,注意最后一个$1的值rewriteEngine onrewriteCond %{http_host} ^xueliwuyou.com [NC]rewriteRule ^(.*)$ http://www.xueliwuyou.com/$1 [R=301,L]以上是301跳转的代码,将不带www跳转到带www的;(把xueliwuyou.com换成你的域名)
阅读全文
摘要:MemAdmin是一款可视化的Memcached管理与监控工具,使用PHP开发,体积小,操作简单。主要功能:服务器参数监控:STATS、SETTINGS、ITEMS、SLABS、SIZES实时刷新服务器性能监控:GET、DELETE、INCR、DECR、CAS等常用操作命中率实时监控支持数据遍历,方便对存储内容进行监视支持条件查询,筛选出满足条件的KEY或VALUE数组、JSON等序列化字符反序列显示兼容memcache协议的其他服务,如Tokyo Tyrant (遍历功能除外)支持服务器连接池,多服务器管理切换方便简洁下载地此:http://www.junopen.com/memadmin/
阅读全文
摘要:ignore_user_abort();//关掉浏览器,PHP脚本也可以继续执行. set_time_limit(0);// 通过set_time_limit(0)可以让程序无限制的执行下去 $interval=60*30;// 每隔半小时运行 do{ //这里是你要执行的代码 sleep($interval);// 等待5分钟 }while(true);
阅读全文
摘要:$filename='veno_license.txt';header("Content-Type: application/force-download");header("Content-Disposition: attachment; filename=".basename($filename)); echo "||";实现流文件下载header('Content-Description: File Transfer');header('Content-Type: application/
阅读全文
摘要:function delDir($dir) { if (! is_dir ( $dir )) return false; $handle = opendir ( $dir ); while ( ($file = readdir ( $handle )) !== false ) { if ($file != "." && $file != "..") is_dir ( "$dir/$file" ) ? delDir ( "$dir/$file" ) : @unlink ( "$dir/$fi
阅读全文