本文整理汇总了PHP中app\models\Post::sensor方法的典型用法代码示例。如果您正苦于以下问题:PHP Post::sensor方法的具体用法?PHP Post::sensor怎么用?PHP Post::sensor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\models\Post
的用法示例。
在下文中一共展示了Post::sensor方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: edit
/**
* @param $id
* @param $id_acc
* @param $title
* @param $post
* @param int $category
*/
public static function edit($id, $id_acc, $title, $post, $category = 2)
{
$cleanPost = \Post::sensor($post, false);
$sql = sprintf("UPDATE `iniforum`.`posts`\n SET `post` = :post, `title` = :title, `id_category` = :category, `modified_at`=now()\n WHERE `posts`.`id` = :id AND `posts`.`id_account` = :id_acc");
$bindArray = [':id' => $id, ':id_acc' => $id_acc, ':title' => $title, ':post' => $cleanPost, ':category' => $category];
self::query($sql, $bindArray);
}
示例2: create
public static function create($from, $to, $subject, $msg)
{
$cleanMsg = \Post::sensor($msg, false);
$sql = sprintf("INSERT INTO `iniforum`.`messages` \n (`id`, `from_account`, `to_account`, `subject`, `text`, `created_at`)\n VALUES (NULL, :from_member, :to_member, :subject, :msg, CURRENT_TIMESTAMP)");
$bindArray = [':from_member' => $from, ':to_member' => $to, ':subject' => $subject, ':msg' => $cleanMsg];
self::query($sql, $bindArray);
}