这是我的Kernel.php代码
protected $commands = [
'App\Console\Commands\cronEmail'
];
protected function schedule(Schedule $schedule)
{
$schedule->command('inspire')->everyMinute();
}
这是我的cronEmail.php代码
protected $signature = 'inspire';
public function handle()
{
$name="asdfasdfasfd";
$email="asdfasdfasfd";
$phone="asdfasdfasfd";
$pass="asdfasdfasfd";
$type="asdfasdfasfd";
$discount=32542345;
$data=array("customer_name"=>$name,"customer_email"=>$email,"customer_phone"=>$phone,"customer_password"=>$pass,"customer_type"=>$type,"customer_discount"=>$discount);
DB::table('customer_det')->insert($data);
}
当我在cmd中运行此命令
时,我的代码正常工作正常php artisan schedule:run
我尝试在bluehost上运行此命令,但它仍无法运行.. !!
/usr/bin/php /home2/pakhakee/public_html/esabzi/artisan schedule:run 1>> /dev/null 2>&1
我在bluehost服务器上尝试了上面的命令,但它仍然没有工作!!
答案 0 :(得分:0)
请更改您的 function handlePost(postTransaction) {
var url = 'https://composer-node-red.mybluemix.net/compute';
return post( url, postTransaction)
.then(function (result) {
// alert(JSON.stringify(result));
postTransaction.asset.value = 'Count is ' + result.body.sum;
return getAssetRegistry('org.example.sample.SampleAsset')
.then(function (assetRegistry) {
return assetRegistry.update(postTransaction.asset);
});
});
并查看:
kernel.php
更新了答案
<强> cronEmail.php 强>
protected $commands = [
\App\Console\Commands\cronEmail::class
];
在终端 中 AND 运行<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use DB;
use Config;
use Mail;
class cronEmail extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'inspire';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
$name="asdfasdfasfd";
$email="asdfasdfasfd";
$phone="asdfasdfasfd";
$pass="asdfasdfasfd";
$type="asdfasdfasfd";
$discount=32542345;
$data=array("customer_name"=>$name,"customer_email"=>$email,"customer_phone"=>$phone,"customer_password"=>$pass,"customer_type"=>$type,"customer_discount"=>$discount);
DB::table('customer_det')->insert($data);
}
}
命令