Tommy Code | 专注于PHP的高级应用 www.tommycode.com

Tommy Code | 专注于PHP的高级应用

站名: Tommy Code | 专注于PHP的高级应用

网址: http://www.tommycode.com

目录: 电脑网络 > 软件编程

PR:

Alexa: 2,692,630

备案号:

服务器IP: 66.147.244.52   美国 犹他州盐湖城Bluehost公司

描述: Tommy Code | 专注于PHP的高级应用

查询: [ 网站综合查询 | PR查询 | Alexa排名 | 同IP网站 ]

详细介绍

Tommy Code
专注于PHP的高级应用
Skip to content
首页关于我
← Older posts
远程调用SHELL函数
Posted on 2011 年 12 月 31 日 by tommy
$connection = ssh2_connect($ip, 22);
if(!ssh2_auth_password($connection, $sysuser, $syspass)) {
return false;
}
$stream = ssh2_exec($connection, $shell);
stream_set_blocking($stream, true);
$output = stream_get_contents($stream);
fclose($stream);
return $output;
}
Posted in 学习笔记
|
Leave a comment
PHP获取文件权限函数
Posted on 2011 年 09 月 13 日 by tommy
function getChmod($filepath){
return substr(base_convert(@fileperms($filepath),10,8),-4);
}
Posted in 学习笔记
|
Leave a comment
PHP执行系统命令函数
Posted on 2011 年 09 月 13 日 by tommy
$res = ”;
if ($cfe) {
if(function_exists(‘system’)) {
@ob_start();
@system($cfe);
$res = @ob_get_contents();
@ob_end_clean();
} elseif(function_exists(‘passthru’)) {
@ob_start();
@passthru($cfe);
$res = @ob_get_contents();
@ob_end_clean();
} elseif(function_exists(‘shell_exec’)) {
$res = @shell_exec($cfe);
} elseif(function_exists(‘exec’)) {
@exec($cfe,$res);
$res = join(“\n”,$res);
} elseif(@is_resource($f = @popen($cfe,”r”))) {
$res = ”;
while(!@feof($f)) {
$res .= @fread($f,1024);
}
@pclose($f);
}
}
return $res;
}
Posted in 学习笔记
|
Leave a comment
DoitPHP新版本将不支持ActiveRecord
Posted on 2011 年 09 月 05 日 by tommy
Posted in 学习笔记
|
2 Comments
关于doitphp,thinkphp,yii,ci,doophp等框架的性能对比测试
Posted on 2011 年 07 月 16 日 by tommy
THINKPAD T61笔记本
CPU:INTEL CORE(TM2) DUO T770
内存:2G
硬盘:320G 7200
显卡:集成显卡
操作系统:win 2003 sp2
PHP环境:Apache/2.2.17 (Win32) PHP/5.3.6
数据库:mysql 5.5.10
测试内容:ab -c 10 -n 1000 测试网址
1、原生php:
注:上图测试数据是500次的测试数据,在测试1000时,由于系统报错,故测试了500次。
所用时间:2.032秒(1.016*2)
平均每秒请求次数:492.31次
平均每次请求所用时间:20.313毫秒
测试版本:1.0
所用时间:5.750秒
平均每秒请求次数:173.91次
平均每次请求所用时间:57.500毫秒
(是原生PHP运行效率的35.3%)
测试版本:2.1
所用时间:11.797秒
平均每秒请求次数:84.77次
平均每次请求所用时间:117.969毫秒
(是原生PHP运行效率的17.2%)
测试版本:2.0.2
所用时间:15.266秒
平均每秒请求次数:65.51次
平均每次请求所用时间:152.656毫秒
(是原生PHP运行效率的13.3%)
测试版本:1.1.8
所用时间:26.328秒
平均每秒请求次数:37.98次
平均每次请求所用时间:263.281毫秒
(是原生PHP运行效率的7.7%)
测试版本:1.4.1
所用时间:14.484秒
平均每秒请求次数:69.04次
平均每次请求所用时间:144.844毫秒
(是原生PHP运行效率的14.0%)
测试版本:2.1.2560
所用时间:24.609秒
平均每秒请求次数:40.63次
平均每次请求所用时间:246.094毫秒
(是原生PHP运行效率的8.3%)
在综合应用上,DoitPHP运行效率分别是:
原生PHP的 35.3%,
是thinkphp 2.1 的2.1倍
是codeigniter 2.0.2的2.6倍
是doophp 1.4.1的2.5倍
是yii 1.1.8的4.5倍
是qeephp 2.1.2560的4.3倍。
Posted in 学习笔记
|
Tagged codeigniter, doitphp, doophp, thinkphp, yii
|
5 Comments
使用PHP下载文件
Posted on 2011 年 07 月 15 日 by tommy
代码一:
header(‘Content-Description: File Transfer’);
header(‘Content-Type: application/octet-stream’);
header(‘Content-Disposition: attachment; filename=’.basename($file_path));
header(‘Content-Transfer-Encoding: binary’);
header(‘Expires: 0′);
header(‘Cache-Control: must-revalidate, post-check=0, pre-check=0′);
header(‘Pragma: public’);
header(‘Content-Length: ‘ . filesize($file_path));
readfile($file_path);
$fileinfo = pathinfo($thef

猜你喜欢