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
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度