Php little.htaccess查询字符串问题?
我的php: 我的.htaccessPhp little.htaccess查询字符串问题?,php,.htaccess,Php,.htaccess,我的php: 我的.htaccess if(isset($_GET['text'])) { $text = $_GET['text']; } else { $text = "default"; //if no ?text= set then print "default" } htaccess实际上工作得很好,除非我没有将文本设置为我的url,否则我的else语句(“default”)不起作用 所以,如果输入mydomain.com/what,一切正常($text=“whatthe”) 然
if(isset($_GET['text'])) {
$text = $_GET['text'];
} else {
$text = "default"; //if no ?text= set then print "default"
}
htaccess实际上工作得很好,除非我没有将文本设置为我的url,否则我的else语句(“default”)不起作用
所以,如果输入mydomain.com/what,一切正常($text=“whatthe”)
然而,当我调用mydomain.com时,$text是空的,而不是包含“default”
我做错了什么?现在发生的情况是,您仍然在设置GET变量,尽管设置为null或空字符串 你应使用:
RewriteEngine On
RewriteRule ^(.*)$ index.php?text=$1 [L,QSA]
if(isset($_GET['text'] && !empty($_GET['text'])) {