本文整理汇总了PHP中self::insert方法的典型用法代码示例。如果您正苦于以下问题:PHP self::insert方法的具体用法?PHP self::insert怎么用?PHP self::insert使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类self
的用法示例。
在下文中一共展示了self::insert方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: append
/**
* 添加回复
*/
public static final function append()
{
$online = front::online();
if (!$online->user_id) {
die('Permission Denied!');
}
//需要登录
$time = time();
while (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] === 'POST') {
$post = array('doc_id' => isset($_POST['doc_id']) ? $_POST['doc_id'] : '', 'email' => isset($_POST['email']) ? $_POST['email'] : '', 'content' => isset($_POST['content']) ? $_POST['content'] : '', 'ip' => get_onlineip(), 'create_date' => date('Y-m-d', $time), 'create_time' => date('H:i:s', $time));
//$post['content'] = htmlentities($content , ENT_COMPAT ,'utf-8') ;
//pecho($post);
if (!empty($error)) {
break;
}
$doc_remark = new self();
$doc_remark->doc_remark_id = null;
$doc_remark->struct($post);
$doc_remark->insert('', 'doc_remark_id');
if ($doc_remark->doc_remark_id) {
$doc = new doc();
$doc->doc_id = $doc_remark->doc_id;
$doc->last_remark = date('Y-m-d H:i:s', $time);
$doc->update();
}
//print_r ( $doc_remark);
header('Location: ?' . $_GET['query']);
return;
}
}
示例2: scanTags
public static function scanTags($inputTags)
{
if (!is_array($inputTags)) {
return false;
}
$inputTags = array_unique($inputTags);
$result = [];
foreach ($inputTags as $v) {
if (empty($v)) {
continue;
}
$slug = StringHelper::generateCleanStr($v);
if (!$slug) {
continue;
}
$model = static::find()->andWhere(['name' => $slug])->one();
if ($model) {
$result[] = $model->mid;
} else {
$tag = new self();
$tag->name = $tag->slug = $slug;
if ($tag->insert(false)) {
$result[] = $tag->mid;
}
}
}
return $result;
}
示例3: add
/**
* add new log entry.
*
* @param int $type The type of add
* + 1 = insertion
* + 2 = update
* + 3 = deletion
* @param string $message
*/
public static function add($type, $message, array $additionalData = [])
{
$attrs = ['is_insertion' => $type == 1 ? 1 : 0, 'is_update' => $type == 2 ? 1 : 0, 'is_deletion' => $type == 3 ? 1 : 0, 'message' => $message, 'data_json' => $additionalData];
$model = new self();
$model->setAttributes($attrs);
return $model->insert(false);
}
示例4: insertQuote
/**
* Insert a new quote.
* @param string $username
* @param string $text
* @return Dog_Quote
*/
public static function insertQuote($username, $text)
{
$quote = new self(array('quot_id' => 0, 'quot_text' => $text, 'quot_username' => $username, 'quot_rating' => 0, 'quot_date' => GWF_Time::getDate(14)));
if (false === $quote->insert()) {
return false;
}
return $quote;
}
示例5: createStatsRow
/**
* @param int $userid
* @return Dog_ScumStats
*/
private static function createStatsRow($userid)
{
$row = new self(array('scums_userid' => $userid, 'scums_games' => 0, 'scums_won' => 0, 'scums_score' => 0));
if (false === $row->insert()) {
return false;
}
return $row;
}
示例6: newMessage
public static function newMessage($sender, $target, $message)
{
$msg = new self(array('chatmsg_time' => time(), 'chatmsg_from' => $sender, 'chatmsg_to' => $target, 'chatmsg_msg' => $message));
if (false === $msg->insert()) {
return false;
}
return $msg;
}
示例7: fromCollection
public static function fromCollection(Collection $initialData)
{
$tree = new self();
foreach ($initialData->toArray() as $element) {
$tree->insert($element);
}
return $tree;
}
示例8: insertEntry
public static function insertEntry($siteid, $score, $usercount, $challcount, $comment = '')
{
$entry = new self(array('sitehist_sid' => $siteid, 'sitehist_date' => time(), 'sitehist_score' => $score, 'sitehist_usercount' => $usercount, 'sitehist_challcount' => $challcount, 'sitehist_comment' => $comment));
if (WECHALL_DEBUG_SCORING) {
echo WC_HTML::message('Inserting Site History Item...');
}
return $entry->insert();
}
示例9: createSecondaryDispatchRunWithChunkedJobList
private function createSecondaryDispatchRunWithChunkedJobList()
{
foreach (array_chunk($this->jobs, self::CHUNK_SIZE, true) as $jobList) {
$hash = md5(json_encode($jobList));
$job = new self(Title::newFromText('UpdateDispatcherChunkedJobList::' . $hash), array('job-list' => $jobList));
$job->insert();
}
}
示例10: createSlapRow
public static function createSlapRow($type, $name, $damage)
{
$row = new self(array('lsi_id' => 0, 'lsi_type' => $type, 'lsi_name' => $name, 'lsi_damage' => $damage, 'lsi_count_a' => 0, 'lsi_count_as' => 0));
if (false === $row->insert()) {
return false;
}
return $row;
}
示例11: newClient
private static function newClient($userid)
{
$client = new self(array('vsc_uid' => $userid, 'vsc_token' => self::generateToken(), 'vsc_modules' => '', 'vsc_designs' => ''));
if (false === $client->insert()) {
return false;
}
return $client;
}
示例12: insertWord
public static function insertWord($hang_word, $iso = 'en')
{
$word = new self(array('hangman_id' => 0, 'hangman_text' => $hang_word, 'hangman_iso' => $iso));
if (false === $word->insert()) {
return false;
}
return $word;
}
示例13: insertToken
public static function insertToken(Module_Download $module, GWF_Download $dl, $user, $token)
{
$expires = $dl->expires() ? GWF_Time::getDate(GWF_Date::LEN_SECOND, time() + $dl->getVar('dl_expire')) : '';
$row = new self(array('dlt_dlid' => $dl->getID(), 'dlt_uid' => $user === false ? 0 : $user->getID(), 'dlt_token' => $token, 'dlt_expires' => $expires));
if (false === $row->insert()) {
return false;
}
return true;
}
示例14: add
public static function add(CategoryForm $form)
{
$category = new self();
$category->pid = 0;
$category->name = $form->name;
$category->status = $form->status;
$category->addtime = time();
return $category->insert();
}
示例15: addChat
public static function addChat($IDParent, $Text, $IDUser = null)
{
if (!isset($IDUser)) {
$IDUser = Zend_Auth::getInstance()->getIdentity()->IDUser;
}
$TheChat = new self();
$Data = array('IDParent' => $IDParent, 'Text' => $Text, 'IDUser' => $IDUser, 'Date' => new Zend_Db_Expr('NOW()'));
return $TheChat->insert($Data);
}