且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Laravel,没有Shell访问的转储自动加载

更新时间:2023-11-16 23:31:16

您不需要shell访问. Artisan包含dump-autoload函数.您可以通过应用程序内的PHP调用来做到这一点:

You dont need shell access. Artisan includes a dump-autoload function. You can just it via a PHP call within your app:

Route::get('/updateapp', function()
{
    \Artisan::call('dump-autoload');
    echo 'dump-autoload complete';
});

只是注意到您写了反正没有在服务器上安装composer" .不知道会发生什么-请尝试上面的命令并告诉我们.

just noticed you wrote "composer isn't installed on the server anyway". Not sure what will happen - try the command above and let us know.

如果它不起作用-那么只需在本地运行composer dump-autoload-然后上传新的autoload.php.

If it doesnt work - then just run composer dump-autoload locally - then upload your new autoload.php.

另一方面,是否有切换服务器的选项?如果没有命令行和&amp ;,您将继续遇到各种问题.作曲家访问.您只需要用Forge并在DigitalOcean,Linode等服务器上启动新服务器,所需的时间就少于解决该问题所需的时间:)

As a side point - is there any option to switch servers? You going to keep running into various issues if you dont have command line & composer access. You could just use Forge and spin up a new server on DigitalOcean, Linode etc in less time than it would take to fix this issue :)