2 回答

TA貢獻1909條經驗 獲得超7個贊
您不應該公開 app_dev.php 文件。該文件僅用于開發環境
環境在 dev 中定義
$kernel?=?new?AppKernel('dev',?true);
在這里獲取產品
$kernel?=?new?AppKernel('prod',?false);
因此,您需要通過公開 app.php 來公開您的服務。這樣,所有開發包(例如 AppKernel.php 上列出的包和配置)都不會被加載

TA貢獻1820條經驗 獲得超10個贊
我已經弄清楚這個問題了。需要取消下面代碼的注釋。
// This check prevents access to debug front controllers that are deployed by
// accident to production servers. Feel free to remove this, extend it, or make
// something more sophisticated.
if (isset($_SERVER['HTTP_CLIENT_IP'])
|| isset($_SERVER['HTTP_X_FORWARDED_FOR'])
|| !(in_array(@$_SERVER['REMOTE_ADDR'], ['127.0.0.1', 'fe80::1', '::1']) || php_sapi_name() === 'cli-server')
) {
header('HTTP/1.0 403 Forbidden');
exit('You are not allowed to access this file. Check '.basename(__FILE__).' for more information.');
}
- 2 回答
- 0 關注
- 148 瀏覽
添加回答
舉報