本文整理匯總了PHP中Host::setIsNewRecord方法的典型用法代碼示例。如果您正苦於以下問題:PHP Host::setIsNewRecord方法的具體用法?PHP Host::setIsNewRecord怎麽用?PHP Host::setIsNewRecord使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Host
的用法示例。
在下文中一共展示了Host::setIsNewRecord方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: actionEdit
public function actionEdit()
{
$msgHost = "";
$request = Yii::app()->getRequest();
$id = trim($request->getParam("id"));
if (!empty($_POST)) {
$ip = trim($request->getPost("ip"));
$admin = trim($request->getPost("admin"));
$username = trim($request->getPost("username"));
$password = trim($request->getPost("password"));
$provider = trim($request->getPost("provider"));
$status = trim($request->getPost("status"));
if ($ip == "") {
$msgHost = "主機IP選項不能留空";
} else {
if (strlen($ip) > 64) {
$msgHost = "輸入不能大於64個字符";
}
}
if ($msgHost == "") {
$host = array('ip' => $ip, 'admin' => $admin, 'username' => $username, 'password' => $password, 'provider' => $provider, 'status' => $status);
try {
$res = new Host();
$res->_pk = $id;
$res->_attributes = $host;
$res->setIsNewRecord(false);
$res->update();
$this->redirect(array('list'));
} catch (CDbException $e) {
throw CDbException($e);
}
}
}
try {
$Rs = new Host();
$rsInfo = $Rs->findByPk($id);
} catch (CDbException $e) {
throw CDbException($e);
}
$this->render('edit', array('r' => Yii::app()->request->baseUrl . '/', 'rsInfo' => $rsInfo, 'msgHost' => $msgHost));
}