本文整理汇总了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>