我用php写过这样的代码
<a href="http://localhost/contactus.html" title="CONTACT US" > CONTACT US</a>
正确的,它应该去 htaccess 文件,看看是否有任何重写。 我的 .htaccess 文件是
RewriteRule ^([^/]+).html /index.php?file=$1 [NC]
所以我想 contactus 应该是 $1 因此 file=contactus 它应该调用
http://localhost/index.php?file=contactus
但这并没有发生。
我检查了 htaccess 重写工作正常并启用。
请帮助。谢谢
最佳答案
尝试:
RewriteRule ^(.*).html$ index.php?file=$1 [NC][L]
关于php - 从 HTML 调用 PHP 的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6105665/