本文整理匯總了PHP中factory::reply_comment_factory方法的典型用法代碼示例。如果您正苦於以下問題:PHP factory::reply_comment_factory方法的具體用法?PHP factory::reply_comment_factory怎麽用?PHP factory::reply_comment_factory使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類factory
的用法示例。
在下文中一共展示了factory::reply_comment_factory方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: InvalidArgumentException
<?php
require_once 'loader.php';
/*
* Here, you can reply a comments of other users under posts
*/
try {
if (isset($_POST['nickname']) && isset($_POST['text'])) {
$nickname = $_POST['nickname'];
$text = $_POST['text'];
$comment_id = $_GET['comment_id'];
if ($nickname != null && $text != null && $comment_id != null) {
$reply_comment = factory::reply_comment_factory();
$reply_comment->savetoDB($comment_id, $nickname, $text);
}
} else {
throw new InvalidArgumentException("Nie uzupełniłeś wszystkich pól!");
}
} catch (Exception $e) {
echo '<h1 class=" grey text-center">' . $e->getMessage() . '</h1>';
}
if (isset($_GET['comment_id']) && isset($_GET['id'])) {
$comment_id = $_GET['comment_id'];
$post_id = $_GET['id'];
try {
$stmt = $pdo->prepare('SELECT id,nickname, text FROM comments WHERE id=' . ':comment_id' . ' ORDER BY id DESC');
$stmt->bindValue(':comment_id', $comment_id, PDO::PARAM_INT);
$stmt->execute();
echo '<div class="post-border well well-lg" style="background-color:rgba(16,16,16,0.95);border:15px solid #272727;"><br><div class="margin-auto comment text-left">';
while ($row = $stmt->fetch()) {
echo '<p class="lead text-left" style="color:white;">' . $row['nickname'] . ' napisał: </p>