本文介紹了如何從 Laravel 控制器寫入控制臺?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!
問題描述
所以我有一個 Laravel 控制器:
So I have a Laravel controller:
class YeahMyController extends BaseController {
public function getSomething() {
Console::info('mymessage'); // <-- what do I put here?
return 'yeahoutputthistotheresponse';
}
}
目前,我正在使用 artisan(它在后臺運行 PHP 的內置開發 Web 服務器)運行該應用程序:
Currently, I'm running the application using artisan (which runs PHP's built-in development web server under the hood):
php artisan serve
我想將控制臺消息記錄到 artisan 進程的 STDOUT
管道.
I would like to log console messages to the STDOUT
pipe for the artisan process.
推薦答案
啊哈!
這可以通過以下 PHP 函數來完成:
This can be done with the following PHP function:
error_log('Some message here.');
在這里找到答案:在 PHP 內置網絡中打印一些東西服務器
這篇關于如何從 Laravel 控制器寫入控制臺?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!
【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!