)
我正在创建一个动态事件创建应用程序,在为事件创建动态网页时遇到了问题。
我的 .htaccess 看起来像
RewriteEngine on
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^([^\.]+)$ $1.php [NC]
RewriteCond %{REQUEST_FILENAME} >""
RewriteRule ^([^\.]+)$ table.php?event=$1 [L]
我的 table.php 看起来像
$getEvent = explode("/",$_SERVER['REQUEST_URI']);
print_r($getEvent);
$conn = new mysqli($host, $username, $password, $dbname);
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$result = $conn->query("SELECT * FROM event where link='$getEvent[4]'");
echo $getEvent[4];
页面结构如下:
http://page.ex/~name.name/reg/
当我尝试进入
http://page.ex/~name.name/reg/joulupidu
尽管“joulupidu”在事件表中,但我得到 404。我不知道在哪里看,因为我以前没有做过很多关于这种东西的工作。
谢谢,WK!