當我運行時php artisan test,我想將測驗生成的所有輸出保存在一個檔案中。我試著做php artisan test 2> te.txt 1> to.txt。但是檔案是空的。我究竟做錯了什么?
我也試過php artisan test | tee test.txtor php artisan test > test.txt。他們兩個都不行。
https://youtu.be/pqNfMDqwixs
uj5u.com熱心網友回復:
為了讓它發揮作用,
您需要無 tty 選項:
php artisan test --without-tty > test.txt
但請注意,它將填充顏色代碼,例如:
[31;1m?[39;22m[39m [2m myTest [22m[39m
所以要正確顯示它,你需要 cat 檔案
uj5u.com熱心網友回復:
您可以使用此語法用控制臺輸出填充檔案
php artisan test >> test.txt
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/471517.html
