我正在使用Symfony框架。
我已将public
文件夹分配到我的子域project.mypage.com
现在我只看到一个空白页面。
如果我将Symfony的根文件夹分配给我的子域并转到project.mypage.com/public
,那么我会看到我的网站!这很奇怪......
这是我在公共文件夹中的index.php:
<?php
use App\Kernel;
use Symfony\Component\Debug\Debug;
use Symfony\Component\Dotenv\Dotenv;
use Symfony\Component\HttpFoundation\Request;
require __DIR__.'/../vendor/autoload.php';
// The check is to ensure we don't use .env in production
if (!isset($_SERVER['APP_ENV'])) {
if (!class_exists(Dotenv::class)) {
throw new \RuntimeException('APP_ENV environment variable is not defined. You need to define environment variables for configuration or add "symfony/dotenv" as a Composer dependency to load variables from a .env file.');
}
(new Dotenv())->load(__DIR__.'/../.env');
}
$env = $_SERVER['APP_ENV'] ?? 'dev';
$debug = (bool) ($_SERVER['APP_DEBUG'] ?? ('prod' !== $env));
if ($debug) {
umask(0000);
Debug::enable();
}
if ($trustedProxies = $_SERVER['TRUSTED_PROXIES'] ?? false) {
Request::setTrustedProxies(explode(',', $trustedProxies), Request::HEADER_X_FORWARDED_ALL ^ Request::HEADER_X_FORWARDED_HOST);
}
if ($trustedHosts = $_SERVER['TRUSTED_HOSTS'] ?? false) {
Request::setTrustedHosts(explode(',', $trustedHosts));
}
$kernel = new Kernel($env, $debug);
$request = Request::createFromGlobals();
$response = $kernel->handle($request);
$response->send();
$kernel->terminate($request, $response);
这是我dev.log中的最后一个条目:
[2018-06-05 15:36:42] request.INFO: Matched route "_wdt". {"route":"_wdt","route_parameters":{"_controller":"web_profiler.controller.profiler:toolbarAction","token":"28c9ba","_route":"_wdt"},"request_uri":"http://project.mypage.com/public/_wdt/38c9ba","method":"GET"} []
答案 0 :(得分:1)
我认为问题出在您的 require 声明中。检查供应商文件夹的位置。
例如:如果您的代码文件(如下)与供应商位于同一目录级别,则您不必在require中使用Observables
。
getData: function(url, params, headers){
return new Promise((resolve, reject) => {
axios.get(url, {
params: params,
headers: headers,
}).then((response) => {
let responseData = response.data.data[0];
if (response.data.next) {
this.getData(response.data.next, {}).then((resp) => {
for (let dataSet of responseData.dataSets) {
let row = resp.dataSets.find(i => i.variable === dataSet.variable)
if (row) {
dataSet.data = dataSet.data.concat(row.data)
}
}
resolve(responseData);
}).catch((error) => {
reject(error)
})
} else {
resolve(responseData);
}
}).catch(error => {
reject(error)
})
})
}
反之亦然,如果目录中有两个或更多级别,则添加'..'
,如此