【发布时间】:2017-01-03 11:03:08
【问题描述】:
我在错误日志中有这个错误
mod_fcgid: stderr: PHP Notice: Undefined index: url in /var/www/vhosts/mysite.it/httpdocs/wp-content/themes/colormag-pro/js/sharrre/sharrre.php 上线
4 行受影响。
它们对我的网站有危险吗?我怎样才能准确地修复它们?
更新:sharre.php 中此代码的前 4 行出错
$json['url'] = $_GET['url'];
$url = urlencode($_GET['url']);
$type = urlencode($_GET['type']);
if(filter_var($_GET['url'], FILTER_VALIDATE_URL)){
if($type == 'googlePlus'){ //source http://www.helmutgranda.com/2011/11/01/get-a-url-google-count-via-php/
$contents = parse('https://plusone.google.com/u/0/_/+1/fastbutton?url=' . $url . '&count=true');
【问题讨论】:
-
这通常意味着 PHP 无法访问数组索引中的项目,实际上根本没有定义。尝试查看 sharrre.php 文件中的行号,看看那里访问了哪些 $variables。
-
对不起。刚刚添加了给出错误的代码行。你知道我应该做些什么来修复这些错误吗?
-
请正确设置标签和标题!
-
你假设
$_GET['url']没有先检查就设置好了。检查它是否使用empty()设置。$_GET['type']相同
标签: php