为什么PHP停止识别$ _GET变量?

时间:2014-05-03 16:53:02

标签: php get

我没有托管访问权限的网站/服务器发生了一些非常奇怪的事情。

我有一个已运行超过2年的脚本。它已从URL地址识别出$_GET vars,没有任何问题。

现在,该脚本突然不会处理任何$_GET$_REQUEST个变量。自从我在2 - 3年前推出PHP脚本以来,我没有对其进行任何更改。

是否有人知道最近的服务器更新或PHP更新是否会导致工作脚本停止识别$_GET vars?

WordPress插件脚本:

function email_this($data)
{
    global $post;
    if(isset($_GET['id']))//if it is a form
    { // 2014-05-03 SCRIPT DOES NOT FALL THROUGH HERE
        email_send(htmlspecialchars($_GET['id']));    
    }
    else//if the button should show
    { // 2014-05-03 SCRIPT FALLS THROUGH HERE
        $data_and_emailthis = $data; // 2011-03-23: split original statement into 2 statements
        $data_and_emailthis .= '<!--'; // 2011-03-23: added this to comment out ability to email articles from non-specified pages
        $data_and_emailthis .= '<br/><p><a href="/email/?id='.get_the_ID().'" rel="nofollow" title="Email this post to your friend" style="font-weight: bold;"><img src="'.get_bloginfo('wpurl').'/wp-content/plugins/emailthis/email.gif" style="border: 0px; padding: 0px; margin: 0px;" alt="Email this post"> Email this post</a></p>'; // 2011-03-23: split original statement into 2 statements
        $data_and_emailthis .= '-->'; // 2011-03-23: added this to comment out ability to email articles from non-specified pages
    }

  //return
  return $data_and_emailthis;
  }

add_filter('the_content', 'email_this');

URL:

http://mydomain.com/email/?id=1506

.htaccess文件

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

<Files 403.shtml>
order allow,deny
allow from all
</Files>

deny from 41.207.163.6

1 个答案:

答案 0 :(得分:2)

我不确定它之前是怎么回事,但要传递查询字符串,您需要修改:

RewriteRule . /index.php [L]

为:

RewriteRule . /index.php [L,QSA]

这样,在将url重写为index.php之后,会追加查询字符串。