本文整理匯總了PHP中post::view方法的典型用法代碼示例。如果您正苦於以下問題:PHP post::view方法的具體用法?PHP post::view怎麽用?PHP post::view使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類post
的用法示例。
在下文中一共展示了post::view方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: intval
<?php
require "../includes/conf.inc.php";
require "../includes/functions.inc.php";
$postId = intval($_GET['id']);
$post = post::view($postId, 1);
if ($post == false) {
die($e);
}
$comments = comment::getComments($postId);
if ($comments == false) {
die($e);
}
if ($comments != 'empty') {
$seeOlder = comment::checkOldComments($postId);
if ($seeOlder == false) {
$seeOlder = '';
}
}
/*$likeObj = new like();
$likeResult = $likeObj->getLikes($postId);
if($likeResult == false){
die($e);
}
if(isset($_SESSION['userLogin'])){
$checkLike = $likeObj->checkLike($postId,$_SESSION['userId']);
if($checkLike == false){
die($e);
} else if($checkLike == "liked"){
$likeStatus = 'Unlike';
示例2: header
require "../../includes/conf.inc.php";
require "../../includes/functions.inc.php";
if (!isset($_SESSION['login'])) {
$_SESSION['error'] = 2;
header("location: ../login.php");
} else {
$adminId = $_SESSION['adminId'];
$admin = get_admin_info($adminId);
if ($admin['roleId'] == 1) {
header("location: ../posts/");
}
if (!isset($_GET['id'])) {
header("location: ../posts/");
} else {
$id = intval($_GET['id']);
$post = post::view($id, 2);
if ($post == 'empty') {
header("location: ../posts/");
}
}
}
?>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<title>Plus Two Notes | Post Editor</title>
<?php
require "../includes/links.php";
?>