本文整理汇总了PHP中comment::insertComment方法的典型用法代码示例。如果您正苦于以下问题:PHP comment::insertComment方法的具体用法?PHP comment::insertComment怎么用?PHP comment::insertComment使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类comment
的用法示例。
在下文中一共展示了comment::insertComment方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: commentAction
public function commentAction()
{
if ($_POST) {
$content = $_POST['content'];
$uid = $_POST['UID'];
$aid = $_POST['AID'];
$rid = $_POST['RID'];
$abstract = substr($content, 0, 100);
$time = date('Y-m-d H:i:s');
$comment = new comment();
$comment_arr = array('UID' => $uid, 'RID' => $rid, 'AID' => $aid, 'Time' => $time, 'Ccontent' => $content, 'Cabstract' => $abstract);
$cid = $comment->insertComment($comment_arr);
//$this->view->cid = $cid;
echo $cid;
//$this->render('commented');
}
}
示例2: sanitize_text
<?php
require "../includes/conf.inc.php";
require "../includes/functions.inc.php";
if (isset($_POST['commentText']) && !empty($_POST['commentText'])) {
$comment['commentText'] = sanitize_text($_POST['commentText']);
$comment['userId'] = intval($_POST['userId']);
$comment['postId'] = intval($_POST['postId']);
$comment = comment::insertComment($comment);
if ($comment == false) {
echo false;
} else {
$cmmtDate = ago($comment['commentDate']);
echo '<li class="comment">
<div class="commenterProfilePic">
<img src="' . $website . $comment['profilePicAddr'] . '"/>
</div>
<div class="commentDetail">
<a href="' . $website . 'account/profile/' . $comment['username'] . '" class="commenter">' . $comment['firstName'] . ' ' . $comment['lastName'] . '</a><br />
<p>' . $comment['commentText'] . '</p>
<span>' . $cmmtDate . '</span>
</div>
<div class="cleaner"></div>
</li>';
}
}
示例3: session_start
<?php
session_start();
if (isset($_SESSION['user'])) {
$temp = $_SESSION['user'];
} else {
header("Location: ../views/signinPage.php?message=" . urlencode("Login again!"));
}
?>
<?php
if ($_REQUEST['thecomment'] != "") {
require_once "../models/comment.php";
$rs = comment::insertComment($_REQUEST['imgId'], $temp['username'], $_REQUEST['thecomment']);
if ($rs == false) {
echo "Comment not Added!", PHP_EOL;
}
}
?>