本文整理匯總了PHP中Info::save方法的典型用法代碼示例。如果您正苦於以下問題:PHP Info::save方法的具體用法?PHP Info::save怎麽用?PHP Info::save使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Info
的用法示例。
在下文中一共展示了Info::save方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: actionCreate
/**
* Creates a new model.
* If creation is successful, the browser will be redirected to the 'view' page.
*/
public function actionCreate()
{
$model = new Info();
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
if (isset($_POST['Info'])) {
//$model->attributes=$_POST['Info'];
//var_dump($model->activity);
foreach ($_POST['Info']['activity'] as $k => $v) {
$model->id = null;
$model->activity = $v;
$model->activity_type = $k;
$model->user_id = $_POST['Info']['user_id'];
$model->isNewRecord = true;
$model->save();
}
//if($model->save())
//$this->redirect(array('view','id'=>$model->id));
}
$this->render('create', array('model' => $model));
}
示例2: foreach
function get_new()
{
include 'themes/fundv2/odbc_connect.php';
$this->load->helper('html');
$rs = $db->Execute("select * from WEB_NEWS ORDER BY ID DESC");
// echo "<pre>";
// print_r($rs);
// echo "</pre>";
foreach ($rs as $row) {
// หาไอดีซ้ำใน db
$info = new Info();
$info->where('intranet_id = ' . $row['ID'])->get();
if ($info->intranet_id == "") {
$_POST['module'] = 'ข่าวประชาสัมพันธ์';
$_POST['slug'] = clean_url(iconv('TIS-620', 'UTF-8', $row['TITLE']));
$_POST['title'] = iconv('TIS-620', 'UTF-8', $row['TITLE']);
$_POST['detail'] = iconv('TIS-620', 'UTF-8', $row['DETAIL']);
$_POST['image'] = 'http://intranet.m-society.go.th/upload/newsletters/' . $row['IMG_TITLE'];
$_POST['intranet_id'] = $row['ID'];
$rs = new Info();
$rs->from_array($_POST);
$rs->save();
echo 'intranet_news id ' . $_POST['intranet_id'] . ' is insert <br>';
}
}
}