本文整理汇总了PHP中comments::addComments方法的典型用法代码示例。如果您正苦于以下问题:PHP comments::addComments方法的具体用法?PHP comments::addComments怎么用?PHP comments::addComments使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类comments
的用法示例。
在下文中一共展示了comments::addComments方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: comments
<?php
require_once 'model/commentsManage.php';
$comments = new comments();
$error = '';
$getCommentsOrder = $comments->getCommentsOrder($pdo);
if (isset($_POST['author']) and isset($_POST['content'])) {
$date = time();
if ($_POST['idComments'] == 0) {
$_POST['author'] = trim(htmlentities($_POST['author']));
$_POST['content'] = trim(htmlentities($_POST['content']));
if (empty($_POST['author']) || empty($_POST['author'])) {
$error = 'Merci de remplir tous les champs';
} else {
$comments->addComments($pdo, $date);
header("Location: index.php?pages=viewArticles&&id=" . $_POST['idArticles']);
exit;
}
} else {
$_POST['author'] = trim(htmlentities($_POST['author']));
$_POST['content'] = trim(htmlentities($_POST['content']));
$comments->updateComments($pdo, $date);
header("Location: index.php?pages=viewArticles&&id=" . $_POST['idArticles']);
exit;
}
}
if (isset($_GET['deleteComments'])) {
//Supprimer un article
$comments->deleteComments($pdo);
header("Location: index.php?pages=viewArticles&&id=" . $_POST['idArticles']);
exit;