Php 如何防止get url显示文本或随机文本
例如,$search=$\u GET[$id] 而不是显示website.com/result.php?find=56 它应该是website.com/result.php?find=sometextPhp 如何防止get url显示文本或随机文本,php,Php,例如,$search=$\u GET[$id] 而不是显示website.com/result.php?find=56 它应该是website.com/result.php?find=sometext 在db 56中,id是id,sometext是标题。当我使用get url id函数时,如何获取要显示的标题向数据库中添加另一个唯一字段,该字段将保存用于页面的slug,并使用该字段。您还可以使用.htaccess重定向,例如: RewriteEngine On RewriteRule ^find
在db 56中,id是id,sometext是标题。当我使用get url id函数时,如何获取要显示的标题向数据库中添加另一个唯一字段,该字段将保存用于页面的slug,并使用该字段。您还可以使用.htaccess重定向,例如:
RewriteEngine On
RewriteRule ^find/(.*)$ result.php?find=$1 [L,QSA]
因此,您可以使用如下URL:
www.company.com/find/some-text
直接前往:
www.company.com/result.php?find=some-text
更好的搜索引擎优化网址:)嗯。。。只需将文本放入URL而不是id。。。?有什么问题吗?