跳转页面

 

转换编码
from GBK to UTF-8

$content = mb_convert_encoding($content, "UTF-8", "GBK");

让运行不超时

set_time_limit(0); 

json数据 decode

$data = json_decode($data, true);

二维数组定义

// 测试用的浏览器信息
$browsers = array(

 "standard" => array (
  "user_agent" => "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.6) Gecko/20091201 Firefox/3.5.6 (.NET CLR 3.5.30729)",
  "language" => "en-us,en;q=0.5"
  ),

 "iphone" => array (
  "user_agent" => "Mozilla/5.0 (iPhone; U; CPU like Mac OS X; en) AppleWebKit/420+ (KHTML, like Gecko) Version/3.0 Mobile/1A537a Safari/419.3",
  "language" => "en"
  ),

 "french" => array (
  "user_agent" => "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; GTB6; .NET CLR 2.0.50727)",
  "language" => "fr,fr-FR;q=0.5"
  )

);

获取IP

function get_clientip(){
    if(isset($_SERVER)){
        if(isset($_SERVER['HTTP_X_FORWARDED_FOR'])){
            $realip = $_SERVER['HTTP_X_FORWARDED_FOR'];
        }elseif (isset($_SERVER['HTTP_CLIENT_IP'])){
            $realip = $_SERVER['HTTP_CLIENT_IP'];
        }else{
            $realip = $_SERVER['REMOTE_ADDR'];
        }
    }else{
        if(getenv('HTTP_X_FORWARDED_FOR')){
            $realip = getenv( 'HTTP_X_FORWARDED_FOR');
        }elseif(getenv('HTTP_CLIENT_IP')){
            $realip = getenv('HTTP_CLIENT_IP');
        }else{
            $realip = getenv('REMOTE_ADDR');
        }
    }
    return $realip;
}

获取post过来的数据

isset($_REQUEST["username"])

读文件

$myfile = "E:\\passwd"; //密码文件所在路径
$file_handle = fopen($myfile, "r");
while (!feof($file_handle)) {
   $line = fgets($file_handle); 
}
fclose($file_handle);

标签: none

添加新评论