本文整理匯總了PHP中Test::set方法的典型用法代碼示例。如果您正苦於以下問題:PHP Test::set方法的具體用法?PHP Test::set怎麽用?PHP Test::set使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Test
的用法示例。
在下文中一共展示了Test::set方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: delete
public function delete()
{
if (UserSession::getInstance()->getAccessLevel() < 3) {
die("<h1>Forbidden resource for you.</h1>");
}
$model = new Test();
$model->set('tst_id', $this->params['tst_id']);
$model->set('tst_deleted', 1);
@($dao = new DAO(Test));
$qbuilder = new QueryBuilder('test');
$qbuilder->addEqual('tst_id', $model->get('tst_id'));
$existent = $dao->findByQuery($qbuilder);
if (count($existent) != 1) {
die("<h1>Prova inválida.</h1>");
}
$existent = $existent[0];
if (!isset($existent)) {
die("<h1>Prova não existe.</h1>");
}
$status = $dao->update($model);
if ($status !== true) {
die("Um erro ocorreu ao tentar atualizar o usuário, favor contatar um professor:<br />" . $status);
}
return true;
}
示例2: _get
public function _get()
{
$test = new Test('test 1');
$test->add_var()->add_var();
$test->set('var3', 200);
$var_list = $test->get_var_data();
$page = new View('main', 'layouts', VPATH);
$sidebar = new View('sidebar', 'layouts', VPATH);
$content = new View('content', 'loading', VPATH);
$header = new View('header', 'loading', VPATH);
$content->merge($test->get_var_data());
$page->set("sidebar", $sidebar->package());
$page->set("header", $header->package());
$page->set("content", $content->package());
$page->render();
}