本文整理汇总了PHP中ArticleModel::getAuthor方法的典型用法代码示例。如果您正苦于以下问题:PHP ArticleModel::getAuthor方法的具体用法?PHP ArticleModel::getAuthor怎么用?PHP ArticleModel::getAuthor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ArticleModel
的用法示例。
在下文中一共展示了ArticleModel::getAuthor方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: indexAction
public function indexAction()
{
if (empty(explode('/', $_SERVER['REQUEST_URI'], 4)[2])) {
header('Location: /');
exit;
} else {
$article_id = explode('/', $_SERVER['REQUEST_URI'], 4)[2];
}
if (ArticleModel::exists($this->pdo, $article_id)) {
if ($_SESSION['auth']['username'] === ArticleModel::getAuthor($this->pdo, $article_id) || $_SESSION['auth']['permissions'] === 'superadmin') {
include '../app/views/editarticle.php';
return;
}
} else {
header('Location: /404');
exit;
}
}
示例2: explode
<?php
$id = explode('/', $_SERVER['REQUEST_URI'], 4)[2];
$title = ArticleModel::getTitle($this->pdo, $id);
$date = ArticleModel::getDate($this->pdo, $id);
$author = ArticleModel::getAuthor($this->pdo, $id);
$content = ArticleModel::getContent($this->pdo, $id);
$edit_author = ArticleModel::getEditAuthor($this->pdo, $id);
$edit_date = ArticleModel::getEditDate($this->pdo, $id);
?>
<!doctype html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Sup'Teaching.fr | <?php
echo $title;
?>
</title>
<link rel="icon" href="/assets/img/favicon.png">
<link rel="stylesheet" href="/assets/css/default.css">
<link rel="stylesheet" href="/assets/css/jquery.sidr.dark.min.css">
<link rel="stylesheet" href="/assets/css/styles.css">
</head>
<body>
<?php
include 'header.php';
?>
<main role="main">
<section class="container">