當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Posts::getPosts方法代碼示例

本文整理匯總了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();
開發者ID:grldchz,項目名稱:grldservice,代碼行數:31,代碼來源:service.php

示例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);
     }
 }
開發者ID:grldchz,項目名稱:grldservice,代碼行數:15,代碼來源:Utils.php

示例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>
開發者ID:vinacovre,項目名稱:web-scripting,代碼行數:31,代碼來源:form.php

示例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>
開發者ID:vinacovre,項目名稱:web-scripting,代碼行數:31,代碼來源:post.php


注:本文中的Posts::getPosts方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。