从昨天开始,我有一个非常奇怪的问题.composer install在我的生产服务器上运行会导致此错误...请记住,我的本地服务器(Homestead VM)上没有任何错误.
Nothing to install or update
Writing lock file
Generating autoload files
Executing command (CWD): php artisan clear-compiled
Executing command (CWD): php artisan optimize
Generating optimized class loader
Compiling common classes
Script php artisan optimize handling the post-install-cmd event returned with an error
[RuntimeException]
Error Output:
Exception trace:
() at phar:///home/site/public_html/composer.phar/src/Composer/EventDispatcher/EventDispatcher.php:177
Composer\EventDispatcher\EventDispatcher->doDispatch() at phar:///home/site/public_html/composer.phar/src/Composer/EventDispatcher/EventDispatcher.php:91
Composer\EventDispatcher\EventDispatcher->dispatchScript() at phar:///home/site/public_html/composer.phar/src/Composer/Installer.php:342
Composer\Installer->run() at phar:///home/site/public_html/composer.phar/src/Composer/Command/InstallCommand.php:131
Composer\Command\InstallCommand->execute() at phar:///home/site/public_html/composer.phar/vendor/symfony/console/Symfony/Component/Console/Command/Command.php:257
Symfony\Component\Console\Command\Command->run() at phar:///home/site/public_html/composer.phar/vendor/symfony/console/Symfony/Component/Console/Application.php:874
Symfony\Component\Console\Application->doRunCommand() at phar:///home/site/public_html/composer.phar/vendor/symfony/console/Symfony/Component/Console/Application.php:195
Symfony\Component\Console\Application->doRun() at phar:///home/site/public_html/composer.phar/src/Composer/Console/Application.php:146
Composer\Console\Application->doRun() at phar:///home/site/public_html/composer.phar/vendor/symfony/console/Symfony/Component/Console/Application.php:126
Symfony\Component\Console\Application->run() …Run Code Online (Sandbox Code Playgroud) 我试图删除Laravel Collection中的最后两行.Collection的大小可能会有所不同,但我总是希望删除最后两个.我通过这样做来管理它,但出于好奇,你认为有更好的方法吗?
这是我的方式:
$results = $results->reverse()->slice(2)->reverse();
Run Code Online (Sandbox Code Playgroud)
非常感谢
约翰