我已经用Lumen构建了一个小应用程序,现在我想把它包括在我的wordpress网站上。然而,我很难让它工作。我的方法是制作一个自定义模板,并将其用于带有我想要的URL的帖子。这是它的外观:
<?php /* Template Name: TestApp */ ?>
<?php
/*
|--------------------------------------------------------------------------
| Create The Application
|--------------------------------------------------------------------------
|
| First we need to get an application instance. This creates an instance
| of the application / container and bootstraps the application so it
| is ready to receive HTTP / Console requests from the environment.
|
*/
$app = require __DIR__.\'/../../../../../my-app/bootstrap/app.php\';
/*
|--------------------------------------------------------------------------
| Run The Application
|--------------------------------------------------------------------------
|
| Once we have the application, we can handle the incoming request
| through the kernel, and send the associated response back to
| the client\'s browser allowing them to enjoy the creative
| and wonderful application we have prepared for them.
|
*/
$app->run();
?>
这个$app
路径对应于根级别目录,其中包含Lumen内容。想法是使用/公共/索引。php作为模板。到目前为止,它仍然有效,但当我查询该网站时,我会得到一个NotFoundHttpException
上的错误$app->run();
行,按RoutesRequests.php -> dispatch (line 108)
. 我想这是因为。htaccess不存在,但是添加它并没有帮助。如何在wordpress页面上包含独立应用程序?