dongmu1914 2019-04-16 20:34
浏览 12
已采纳

php中_('')的含义及其内部的含义?

I was reading and learning a code and I found this code, infoBookingsTitle shows the title of the page, which is "Reservation options", I tried to found this file to edit the "Reservation options" word with something else but I didn't know where should I look, like what is that a PHP file, class or what?

          <div>

          <h2>   <?php __('infoBookingsTitle') ?>  </h2>

          </div>

Thanks.

  • 写回答

1条回答 默认 最新

  • douwei4370 2019-04-16 20:38
    关注

    It's not built into PHP, but like @SLaks said, it's usually for translation. When a different language file is used, it will look through that file for the translation of infoBookingsTitle and show that instead. Usually the __() function will return the string, and the _e() function will echo it.

    <?php
    echo __('Hello');
    _e(' World');
    
    // Result: "Hello World" will be displayed, unless a translation file is available
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 VB.NET画图时的撤销编程
  • ¥15 C# webservice 参数特殊字符处理
  • ¥15 关于控制时间更新的一个操作
  • ¥15 JAVA中使用poi创建word文件,实现页面边框环绕页眉
  • ¥15 matlibplot绘图图形切线问题
  • ¥15 flink 深度优先搜索
  • ¥15 python for everybody 使用Beautifulsoup构建soup对象的时候疯狂报错
  • ¥15 mac playcover上原神在登录后的加载页面闪退,重新下载原神IPA和playcover均无效
  • ¥20 node-dev能不能离线安装?
  • ¥20 六子棋博弈基于Alpha-Beta剪枝搜索算法的优化