【发布时间】:2014-11-04 10:12:25
【问题描述】:
我在 wordpress 网站上使用 angular 来生成动画页面过渡。 angular HTML 代码由 PHP 在 wordpress 自定义模板中生成,我设置了 angular 来获取单个 php 文件。
当 php 文件通过 angular 获取时,基本的 php 代码可以正常执行。但是,找不到任何与 wordpress 相关的内容。我猜是因为 wordpress php 文件已经在初始页面加载时执行了。
我在 php 文件中使用了 require 并给出了我正在使用的一些文件的路径,但它们仍然需要 wordpress php 文件才能运行,因此它们会抛出 500 (Internal Server Error)
<div id="pageone">
<p>This is page 1.</p>
<a href="#page2">Go to page 2 </a><br>
<?php
echo ('this php line works');
require './../../lib/custom.php';
echo ('this file is found, but needs wordpress functions, so throws 500 error');
?>
</div>
我想我可以使用 require 来获取核心的 wordpress php 文件,但我不知道那是哪个 php 文件..
【问题讨论】: