变量工作时,此代码的确切部分不起作用isset不带撇号
if(isset($_GET['Champion'])){
$championget = trim(urldecode($_GET['Champion']));
echo $championget;
$championexists = $conn->prepare("SELECT * FROM champions where Champion = ?");
$championexists->bind_param('s', $championget);
$championexists->execute();
$championexistsresult = $championexists->get_result();
if(mysqli_num_rows($championexistsresult)==0){
echo 'Champion doesn\'t exist';
exit;
}elseif(mysqli_num_rows($championexistsresult)>=1)
{
//Continue here
include('php/champion.php');
exit;
}
}
正常工作与普通的名字,如http://localhost/leaguenotes/Cassiopeia 但我在他们拥有的名字就是为什么我编码他们,使他们看起来像这样http://localhost/leaguenotes/Cho%27Gath但我重定向到文件夹的索引
这里也是htaccess的,可能是错
ErrorDocument 404/
ErrorDocument 403/
Options ALL -Indexes
RewriteEngine On
RewriteRule ^([0-9/.]+)$ index.php?Patch_No=$1 [NC,L]
RewriteRule ^([0-9/.]+)&([0-9a-zA-Z_-]+)$ index.php?Patch_No=$1&tab=$2 [NC,L]
RewriteRule ^patches php/patches.php [NC,L]
RewriteRule ^([0-9a-zA-Z_-]+)$ index.php?Champion=$1 [NC,L]
这似乎是因为%27我的代码不作为变量interper这个
%,因为它不是该组将不匹配您的正则表达式模式。 –
是否有将%添加到模式的简单方法? – Higeath
当然,让它。例如'^([0-9a-zA-Z _% - ] +)$'编辑:确保连字符是最后一个,或者逃脱。 –