php 自己写的php压力测试工具
自己写的php压力测试工具 php脚本,利用文本里面的url,随机取出url来压力测试[代码片段(22行)]
php脚本,利用文本里面的url,随机取出url来压力测试
<?php
$doman = $argv[1];
$port = $argv[2];
$file = file("url.text");
$file_arr = array();
foreach($file as &$line){
$file_arr[] = trim($line);
}
//print_r($file_arr);
$time1 = time();
for($i=0; $i<100000; $i++){
$random = rand(0,189);
$rand_url = 'http://'.$doman.':'.$port.$file_arr[$random];
$content = file_get_contents($rand_url);
}
$time2 = time();
echo $time2 - $time1;
echo "\\n";
//该片段来自于http://outofmemory.cn
- 上一篇:php 数组比较,查找连续数实例
- 下一篇:php 具有通用性二维数组排序算法函数
精彩图集
精彩文章






