laravel的解决方案

时间:2023-03-09 20:55:39
laravel的解决方案

对form表单批量去掉前后空格trim:

$request->merge(array_map('trim', $request->all()));

Input::merge(array_map('trim', Input::all()));

  

Laravel中执行Linux SSH命令使用symfony的process

http://symfony.com/doc/current/components/process.html

use Symfony\Component\Process\Process;

$process = new Process('ls -lsa');
$process->run(); // executes after the command finishes
if (!$process->isSuccessful()) {
throw new \RuntimeException($process->getErrorOutput());
} echo $process->getOutput();

Laravel中添加定时任务

找到文件\laravel5\app\Console\Kernel.php

protected function schedule(Schedule $schedule)
{
$schedule->call('Full\Namespace\YourController@method')
->hourly();
}