1

我的 boxbilling 脚本有问题。所有的 phtml 文件都拒绝解析我的 php 代码。我已经确认所有处理程序和类型都已添加并正在工作。很奇怪,当我创建自己的 .phtml 并将我的 html 和 php 代码放入其中时,它可以工作。而且似乎对 boxbilling 的支持已经死了。我打算从我的另一个站点获取一个 wordpress 菜单到我当前的站点。使用这些 php 代码。谢谢你们。

<?php 
require( '/home/admin/public_html/wp-load.php' );
$wp->init();
$wp->parse_request();
$wp->query_posts();
$wp->register_globals();
 ?>

<?php 
if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('my_mega_menu') ) : ?>
<?php endif; ?>

下面的代码是 .phtml 的一部分,我已经标记了代码应该去的区域。谢谢

<div class="top-buttons">
                <a id="login-form-link" class="bb-button bb-button-submit" href="{{ 'login'|link }}">{% trans 'Sign in' %}</a>
                <a class="bb-button bb-button-red" href="{{ 'login'|link }}?register=1">{% trans 'Register' %}</a>
            </div>
            {% endblock %}
            {% endif %}
        </div>
        <div class="clear"></div>
    </div>
</div>

<!-- START MENU FROM WORDPRESS -->

<!-- END OF MENU FROM WORDPRESS -->

下面的代码是页面上显示的内容。

init(); $wp->parse_request(); $wp->query_posts(); $wp->register_globals(); ?>

更新:我刚刚检查了检查元素,如果我只使用此代码,我的 php 代码会自动注释。

<!--?php
require( '/home/admin/public_html/wp-load.php' );
get_header();
?-->

我粘贴了已经注释的代码。

4

1 回答 1

0

此错误是由 wordpress .htaccess 文件引起的,默认情况下它不“支持” .phtml 文件,只需添加:

AddType application/x-httpd-php .php .phtml

到 .htaccess 文件,脚本应该可以工作。

PS 如果您不使用 .htaccess 文件进行重定向,请考虑将其删除。

于 2013-10-11T21:03:52.883 回答