Laravel控制台:如何使用

Laravel控制台:如何使用,laravel,Laravel,我已经看到了,但是其中的解决方案没有使用Laravel方法 我想做这样的事情: $this->info('This is the result: ', $result); 试试这个 $this->info('This is the result: '); dump($result); 您可以对打印对象使用dump()试试这个 $this->info('This is the result: '); dump($result); 您可以使用dump()打印打印对象我相信您正

我已经看到了,但是其中的解决方案没有使用Laravel方法

我想做这样的事情:

$this->info('This is the result: ', $result);
试试这个

$this->info('This is the result: ');
dump($result);
您可以对打印对象使用
dump()

试试这个

$this->info('This is the result: ');
dump($result);

您可以使用
dump()
打印打印对象

我相信您正在寻找:

$output = new \Symfony\Component\Console\Output\ConsoleOutput(2);

$output->writeln('This is the result: ', $result);

我相信您正在寻找:

$output = new \Symfony\Component\Console\Output\ConsoleOutput(2);

$output->writeln('This is the result: ', $result);

顺便说一句,您知道可以在双引号中包含变量以输出,这是php的第一个基本功能。
$this->info(“这是结果:{$result}”)

顺便说一句,您知道可以在双引号中包含变量以输出,这是php的第一个基本功能。
$this->info(“这是结果:{$result}”)

您可以在类中创建自己的
$this->infoAndLog
函数,该函数调用
$this->info()
,并执行其他操作。(或扩展
info()
函数)您可以在类中创建自己的
$this->infoAndLog
函数,该函数调用
$this->info()
,并执行其他操作。(或扩展
info()
函数。)