以下是 laravel app 的 index.blade.php。
<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en-GB" xmlns="http://www.w3.org/1999/xhtml">
<?php
global $wp_rewrite;
define('WP_USE_THEMES', true);
// require_once (app_path().'/libraries/wp-config.php');
// require (app_path().'/libraries/wp-load.php');
require (app_path().'/libraries/wp-blog-header.php');
// require ('../app/libraries/wp-blog-header.php');
?>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=Edge;chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0" />
<title> @yield('title') </title>
</head>
<body @yield('bodyclass')>
<div id="container">
<div id="primary-menu" class="dropdown-menu-wrap">
<?php wp_nav_menu(array('theme_location' => 'primary',
'container' => false,
'menu_class' => 'menu',
'menu_id' => '',
'fallback_cb' => false
)); ?>
</div>
试图调用现有 wordpress 应用程序的菜单。虽然 config.php 是直接从现有的 wordpress 下载的,但 wp_include 是从新的 wordpress 文件中重新下载的。与 wp-blog-header、wp-load 和 wp-setting 相同。
我不知道为什么不断弹出调用非对象的成员函数 main() 的错误。测试了所有可用的解决方案,但失败了。
function wp( $query_vars = '' ) {
global $wp, $wp_query, $wp_the_query;
$wp->main( $query_vars );
if ( !isset($wp_the_query) )