这是我的网页网址
http://myaliveidea.com/news/news/readmore/56/%20When%20Harry%20and%20Sally%20met%20New%20York%20City
但我想要这样的页面网址
http://myaliveidea.com/news/news/readmore/59/When-Harry-and-Sally-met-New-York- City
答案 0 :(得分:2)
使用urldecode();
$url = urldecode($url);
然后替换spaces(' ') by - using str_replace();
答案 1 :(得分:2)
这个问题的解决方案是
<?php
$url = str_replace(' ','-',$sport['title']);
$url = str_replace(":",'',$url);
$url = str_replace("'",'',$url);
?>
<a href="<?php echo base_url().'news/readmore/'.$sport['id']."/".urlencode($url);?>"><?php echo $sport_top['title'];?></a>