为什么PHP停止识别$GET变量?
我没有主机访问权限的站点/服务器发生了一些非常奇怪的事情 我有一个已经运行了两年多的脚本。它已从URL地址识别为什么PHP停止识别$GET变量?,php,get,Php,Get,我没有主机访问权限的站点/服务器发生了一些非常奇怪的事情 我有一个已经运行了两年多的脚本。它已从URL地址识别$\u GET变量,没有问题 现在,脚本突然不处理任何$\u GET或$\u请求变量。自从我在2-3年前启动PHP脚本以来,我没有对它们进行任何更改 有人知道最近是否有服务器更新或PHP更新会导致工作脚本停止识别$\u GETvars吗 WordPress插件脚本: function email_this($data) { global $post; if(isset($
$\u GET
变量,没有问题
现在,脚本突然不处理任何$\u GET
或$\u请求
变量。自从我在2-3年前启动PHP脚本以来,我没有对它们进行任何更改
有人知道最近是否有服务器更新或PHP更新会导致工作脚本停止识别$\u 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');
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
#开始WordPress
重新启动发动机
重写基/
重写规则^index\.php$-[L]
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写规则/index.php[L]
#结束WordPress
命令允许,拒绝
通融
从41.207.163.6开始拒绝
我不确定以前是怎么回事,但要传递查询字符串,您需要修改:
RewriteRule . /index.php [L]
致:
这样,在url被重写为
index.php
嗨,再次:)之后,查询字符串就会被追加。你确定,你的html链接包含id=SOME_id
?非常确定……我修改了我的OQ,并且这个脚本和站点在几年内没有改变。唯一可能发生变化的是数据中心对服务器或PHPHave所做的事情。例如,您在.htaccess
文件中更改/添加了任何重写规则?看起来像是wordpress相关的问题。可能是由其他脚本处理的/email
url,或者类似于此OK的其他内容,但是我将我的脚本从测试\u GET['id']
更改为if(strpos($\u SERVER['REQUEST\u URI'],'/email/')!==false)//如果它是一个表单,并且它正在工作。因此,即使没有htaccess规则,我也要移动一个,如果您在index.php中有var\u dump($\u GET)
,并且您尝试打开index.php/blablabla/?id=1
,它将找到id
key@H.Ferrence它是如何工作的?我假设您的邮件功能中需要ID。@RoyalBg OP正在打开/email/?ID=1506
,它被重写为index.php
。我不知道“它是如何工作的”ID是在我的后续功能中提取的——对我来说太奇怪了
RewriteRule . /index.php [L,QSA]