2017-03-31 10:55
浏览 36


I am using CI framework for my project. If I use like this

$title= "प्रदेश";      // प्रदेश is written in nepali langauge.

echo $title;        // It will display प्रदेश

Now I want to use

<a href = "<?php echo base_url("home/$title")?>">    //home is a controller  

Now In home controller if I tried to display$title it will not show प्रदेश.

It will display like this %E0%A4%AA%E0%A5%8D%E0%A4%B0%E0%A4%A6%E0%A5%87%E0%A4%B6

Please help me.

图片转代码服务由CSDN问答提供 功能建议

我正在为我的项目使用CI框架。 如果我这样使用

  $ title =“प्रदेश”;  //प्रदेश用尼泊尔语写成。
echo $ title;  //它将显示प्रदेश


 &lt; a href =“&lt;  ?php echo base_url(“home / $ title”)?&gt;“&gt;  // home是一个控制器

现在在家庭控制器中,如果我试图显示 $ title ,它将不会显示प्रदेश。

它将显示如下%E0%A4%AA%E0%A5%8D%E0%A4%B0%E0%A4%A6%E0%A5%87%E0%A4 %B6


  • 写回答
  • 好问题 提建议
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • duanbi3151 2017-03-31 11:00

    The base_url calls urlencode on the string, which makes it into url entities.
    A space becomes %20 and things like that.

    The url that is displayed is actually correct and should be interpretted correctly by the server, even if it's gibberish according to humans.

    If you really want the human readable characters for some reason you can do two approaches, urldecode the resulting url(not recommended):

    echo urldecode(base_url("home/$title"));


    echo base_url("home/").$title
    解决 无用
    打赏 举报

相关推荐 更多相似问题