dthtvk3666 2017-03-31 10:55
浏览 36
已采纳

如何在CodeIgniter中使用unicode?

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.

  • 写回答

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"));
    

    or

    echo base_url("home/").$title
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 LiBeAs的带隙等于0.997eV,计算阴离子的N和P
  • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘
  • ¥15 matlab有关常微分方程的问题求解决
  • ¥15 perl MISA分析p3_in脚本出错
  • ¥15 k8s部署jupyterlab,jupyterlab保存不了文件
  • ¥15 ubuntu虚拟机打包apk错误
  • ¥199 rust编程架构设计的方案 有偿
  • ¥15 回答4f系统的像差计算
  • ¥15 java如何提取出pdf里的文字?
  • ¥100 求三轴之间相互配合画圆以及直线的算法