当我向后端发送一个整数时,我将它作为字符串接收,我不知道为什么?
var formdata = new FormData();
for (var i = 0; i < scope.user.values.length; i++) {
formdata.append('values[]', scope.user.values[i]);
}
Run Code Online (Sandbox Code Playgroud)
我以字符串形式接收值,而它们应该是整数
我正在尝试实现排队,但是结果不是异步的,并且我已经应用了以下内容
config/queue.php
'default' => env('QUEUE_DRIVER', 'database'),
'connections' => [
'sync' => [
'driver' => 'sync',
],
'database' => [
'driver' => 'database',
'table' => 'jobs',
'queue' => 'default',
'expire' => 60,
],
]
Run Code Online (Sandbox Code Playgroud)
然后应用以下命令php artisan queue:table php artisan migration
然后运行
php artisan queue:listen
Run Code Online (Sandbox Code Playgroud)
这是功能
SomethingController.php
$model1 = new \App\Model1;
public function store(){
Log::debug('before dispatch');
$this->dispatch(new SendGiftCommand($model1));
Log::debug('before dispatch');
return true;
}
SendGiftCommand.php
{
Log::debug('handle');
SendGift::SendGiftAgedBased($this->model1);
sleep(4);
Log::debug('SendGiftCommand end');
}
SendGift.php
public static function SendGiftAgedBased(Model1 $model1){
Log::debug('inside SendGiftAgedBased');
}
Run Code Online (Sandbox Code Playgroud)
即使该进程已运行,但仍未同步,它会等待命令完成以返回控制器中的响应
我按此顺序搅拌日志 …
我有以下输入,这是一个切换,返回true,false
<input id="{{event.id}}" ng-model="event.is_active" type="checkbox" value="true" class="block__input" ng-class="{'input__toggle--active' : event.is_active}">
Run Code Online (Sandbox Code Playgroud)
当我这样发送时
var formData = new FormData();
console.log(scope.event.is_active);
formData.append('is_active', scope.event.is_active);
Run Code Online (Sandbox Code Playgroud)
在服务器中,我以字符串“ true”,“ false”接收到false和true
如何解决这个问题呢 ?
我正在尝试关注如何运行Cron Jobs的Laravel文档,我想添加它
* * * * * php /path/to/artisan schedule:run >> /dev/null 2>&1
Run Code Online (Sandbox Code Playgroud)
但我不知道如何将它添加到Heroku.