【问题标题】:get html file content in wordpress template standards在 wordpress 模板标准中获取 html 文件内容
【发布时间】:2014-02-24 08:47:13
【问题描述】:

我正在尝试在 wordpress 管理端获取 html 文件内容,我只是尝试了 file_get_contents,但它在某些 wordpress 版本中无法正常工作。然后我找到了wp_remote_get函数;这个工作正常,但wp_debuger 注意到错误:

严格的标准:只能通过引用传递变量

那么我如何简单地将 html 文件内容赋给变量呢? 提前致谢。

我试过了:

$template=wp_remote_retrieve_body(wp_remote_get(get_template_directory_uri().'/‌​admin/templates/settings.htm'));

【问题讨论】:

  • file_get_contents 而不是file_get_content
  • 很好的解决方案.......
  • 来吧,伙计们,有没有 wordpress 开发人员??
  • 我试过$template=wp_remote_retrieve_body(wp_remote_get(get_template_directory_uri().'/admin/templates/settings.htm'));

标签: php wordpress templates


【解决方案1】:

文件系统 API:文件系统 API 抽象出在各种主机类型上安全地在文件系统中读取和写入本地文件所需的功能。

检查参考:Filesystem API

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-03-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-10-29
    • 2012-02-15
    • 1970-01-01
    相关资源
    最近更新 更多