当我试图重定向到其他网站时,我收到此错误:
遇到PHP错误
严重性:警告
消息:parse_url(/%22**)[function.parse-url]:无法解析URL
文件名:core/URI.php
行号:219
遇到了错误
所提交的网址带有不被接受的字符.
这是我在URI.php中的所有代码
private function _detect_uri()
{
if ( ! isset($_SERVER['REQUEST_URI']) OR ! isset($_SERVER['SCRIPT_NAME']))
{
return '';
}
$uri = $_SERVER['REQUEST_URI'];
if (strpos($uri, $_SERVER['SCRIPT_NAME']) === 0)
{
$uri = substr($uri, strlen($_SERVER['SCRIPT_NAME']));
}
elseif (strpos($uri, dirname($_SERVER['SCRIPT_NAME'])) === 0)
{
$uri = substr($uri, strlen(dirname($_SERVER['SCRIPT_NAME'])));
}
// This section ensures that even on servers that require the URI to be in the query string (Nginx) a correct
// URI is found, and also fixes the …Run Code Online (Sandbox Code Playgroud) 我正在尝试从Contrie接收有关Alexa热门网站的信息,我希望收到:
对于我已经获得的URL,但是当我为网站位置添加标签时,某些东西不起作用,这是我的代码:
<?php
for ($z=0;$z<2;$z++) {
$html=file_get_contents('http://www.alexa.com/topsites/countries;'.$z.'/PT');
preg_match_all(
'/<div class="count">.*?<\/div>.*?<a href="\/siteinfo\/.*?">(.*?)<\/a>/s',
$html,
$array, //array with sites
PREG_SET_ORDER
);
for ($i=1;$i<count($array);$i++) {
echo "<pre>"; print_r($array); echo "</pre>";
}
}
?>
Run Code Online (Sandbox Code Playgroud)
我明白了:
Array
(
[0] => Array
(
[0] =>
1
google.pt
[1] => google.pt
)
[1] => Array
(
[0] =>
2
Run Code Online (Sandbox Code Playgroud)