本文整理汇总了PHP中Posts::getPosts方法的典型用法代码示例。如果您正苦于以下问题:PHP Posts::getPosts方法的具体用法?PHP Posts::getPosts怎么用?PHP Posts::getPosts使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Posts
的用法示例。
在下文中一共展示了Posts::getPosts方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Auth
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
**/
require_once 'Auth.php';
$auth = new Auth();
try {
$auth->authenticate();
require_once 'Comment.php';
require_once 'Media.php';
require_once 'Posts.php';
require_once 'Profile.php';
require_once 'Skillet.php';
require_once 'Utils.php';
if (isset($_GET["get"]) && $_GET["get"] == "posts") {
$posts = new Posts($auth);
$posts->getPosts();
print $posts->printOutput();
} else {
if (isset($_GET["get"]) && $_GET["get"] == "media") {
$media = new Media($auth);
$media->getMedia();
print $media->printOutput();
} else {
if (isset($_POST['changepass'])) {
$auth->changePassword();
print $auth->printOutput();
} else {
if (isset($_POST["comment"])) {
$posts = new Posts($auth);
$posts->post();
print $posts->printOutput();
示例2: setMainImage
public function setMainImage($image, $id, $overwrite)
{
$grldPosts = new Posts($this->auth, $id);
$grldPosts->getPosts();
$output = $grldPosts->getOutput();
$post = $output["msg"]["posts"][0];
//var_dump($grldPosts->printOutput());
if ($post["image"] == null || $overwrite == true) {
$stmt = $this->getDb()->prepare("update contents set\n\t\t\t\timage=:image \n\t\t\t\twhere id=:id");
$stmt->bindValue(':image', $id . "/img_profile_" . $image . ".jpeg", PDO::PARAM_STR);
$stmt->bindValue(':id', intval($id), PDO::PARAM_INT);
$stmt->execute();
$this->setOutput(self::$SUCCESS, "Set main image: " . $image);
}
}
示例3: Posts
<?php
include 'conf/conf.php';
$obj = new Posts();
$postsPDO = $obj->getPosts();
$posts = array();
foreach ($postsPDO as $key => $value) {
$posts[$key]['id'] = $value['id'];
$posts[$key]['title'] = $value['title'];
$posts[$key]['content'] = $value['content'];
}
// pr($posts);
?>
<DOCTYPE! html>
<html>
<head>
<meta charset="utf-8">
<title>Interacting With Database</title>
</head>
<body>
<h1 style="text-align:center">Blog</h1>
<h2>Post</h2>
<form action="formcontroller.php" method="POST">
Title:<br>
<input type="text" name="post_title" size="102"><br>
Content:<br>
<textarea name="post_content" rows="20" cols="100"></textarea>
<br>
示例4: Posts
<?php
include 'conf/conf.php';
$id = $_GET["id"];
$data["condition"] = "id = {$id}";
$obj = new Posts();
$postsPDO = $obj->getPosts($data);
foreach ($postsPDO as $key => $value) {
$posts[$key]['id'] = $value['id'];
$posts[$key]['title'] = $value['title'];
$posts[$key]['content'] = $value['content'];
}
$post = reset($posts);
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<h1><?php
echo $post['title'];
?>
</h1>
<p><?php
echo $post['content'];
?>
</p>
<a href="index.php">Back</a>
</body>