[英]Php url space replace with dash(-) by .htaccess file
I've php link like that 我有这样的PHP链接
echo "<h4><a href='$bname_d'>$bname_d</a></h4>'
If $bname_d = Creativeartbd host company then the url is show 如果$ bname_d = Creativeartbd托管公司,则显示URL
http://mysite.com/Creativeartbd host company (2 space in this url)
So how do i replace this space with dash by php/.htaccess ? 那么我如何用php / .htaccess用破折号替换这个空间呢?
Currently I used following .htaccess rules 目前,我使用了以下.htaccess规则
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /businesspage.php?page=$1 [L]
Thanks for your help. 谢谢你的帮助。
pass the url through this <?php $bname_d = str_replace(' ','-',$bname_d); ?>
通过此
<?php $bname_d = str_replace(' ','-',$bname_d); ?>
<?php $bname_d = str_replace(' ','-',$bname_d); ?>
that will replace spaces with '-' <?php $bname_d = str_replace(' ','-',$bname_d); ?>
将用'-'替换空格
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.