[英]Getting error: `Maximum execution time` when send Mail Queue in Laravel
[英]Laravel maximum execution time error when trying to open .txt file
我有一個包含國家/地區及其代碼的.txt文件,我想從中獲取內容並插入數據庫。 但是當為什么嘗試使用php函數fopen()打開文件時,它會拋出最大執行時間錯誤,這里是代碼:web.php:
Route::get('/countries', 'PageController@insertCountries');
的PageController:
public function insertCountries()
{
$file = fopen(asset('databases/countries.txt'), 'r');
return 'ok';
}
文件大小為6KB。 我正在使用Laravel 5.4 EDIT:該文件位於文件夾數據庫中的mu公共文件夾中
如果要打開本地文件,請使用File facade直接使用文件系統,也不應使用asset()
幫助程序。 所以,做這樣的事情:
$file = File::get('/full/path/to/the/file/countries.txt');
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.