本文整理匯總了PHP中app\models\Task::insert方法的典型用法代碼示例。如果您正苦於以下問題:PHP Task::insert方法的具體用法?PHP Task::insert怎麽用?PHP Task::insert使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類app\models\Task
的用法示例。
在下文中一共展示了Task::insert方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: receiver
public static function receiver($output)
{
foreach ($output as $line) {
Yii::info('$line: ' . $line, 'task-receiver');
}
$return = Task::sscanfOutput($output);
if ($return) {
Yii::info('sscanfOutput, return', 'task-receiver');
$from = 0;
$to = 0;
$action = 0;
$message = '';
list($from, $to, $action, $message) = $return;
Yii::info('$message: ' . $message, 'task-receiver');
$modelTask = new Task();
$modelTask->from_device_id = $from;
$modelTask->to_device_id = $to;
$modelTask->action_id = $action;
$modelTask->data = $message;
if (!$modelTask->insert()) {
print_r($modelTask->errors);
Yii::error($modelTask->errors, 'task-receiver');
Yii::error('return 0 (false)', 'task-receiver');
return 0;
}
Yii::info('return 1 (true)', 'task-receiver');
return 1;
}
Yii::info('sscanfOutput, !return', 'task-receiver');
Yii::error('return 0 (false)', 'task-receiver');
return 0;
}