本文整理汇总了PHP中Tweet::getText方法的典型用法代码示例。如果您正苦于以下问题:PHP Tweet::getText方法的具体用法?PHP Tweet::getText怎么用?PHP Tweet::getText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tweet
的用法示例。
在下文中一共展示了Tweet::getText方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Tweet
<?php
include 'header.php';
if ($_SERVER['REQUEST_METHOD'] == 'GET') {
//$newTweet = new Tweet();
$_SESSION['tweetToUpdateId'] = $_GET['updateTweet'];
$newTweet = new Tweet();
$newTweet->loadFromDB($conn, $_GET['updateTweet']);
echo "Stara treść tweeta: " . $newTweet->getText();
// niezbyt secure - przerobić na metodę POST
}
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$newTweet = new Tweet();
echo "Tweet zaktualizowany";
$newTweet->udpateTweetInDb($conn, $_SESSION['tweetToUpdateId'], $_POST['tweetUpdatedText']);
// zmiana treści Tweeta
}
echo '
<div class="row">
<div class="col-sm-6 col-md-4 col-md-offset-4">
<!--<h1 class="text-center login-title">Sign in to continue to Bootsnipp</h1>-->
<div class="account-wall">
<!--<img class="profile-img" src="img/login.jpg"alt="">-->
<form class="form-signin" action="edit_tweet.php" method="post">
<h3><legend>Wpisz nowy text Tweeta</legend></h3>
<label for="">Treść Tweeta</label><br>
<textarea name ="tweetUpdatedText"rows="4" cols="70"></textarea></br>
<button type="submit" class="btn btn-lg btn-primary btn-block">Wyslij</button>
<span class="clearfix"></span>
</form>
</div>
示例2: Tweet
<?php
include 'header.php';
$tempTweet = new Tweet();
$tempTweet->loadFromDB($conn, $_GET['displayTweet']);
$tempTweet->loadUserFromDBforTweet($conn, $_GET['displayTweet']);
$tempUser = new User();
$tempUser->loadFromDB($conn, $tempTweet->getId_user());
echo '<div class="container">';
echo "Author: " . $tempUser->getName();
echo "<hr>";
echo $tempTweet->getText();
echo "<hr>";
if ($_SERVER['REQUEST_METHOD'] == 'POST' && !empty($_POST['comment'])) {
$tempComment = new Comments();
$tempComment->saveCommentsToDb($conn, $_SESSION['user_id'], $_GET['displayTweet'], $_POST['comment']);
// $tempComment = null;
}
//if(!isset($tempComment)){
// $tempComment = new Comments();
// };
echo "<h4>Komentarze:</h4>";
//echo ("<hr>");
$retArray = $tempTweet->getAllComments($conn);
echo "<br>";
foreach ($retArray as $comment) {
?>
<br>
<div class = 'text-center'>
<?php
echo $comment->getText();
示例3:
</div>
</nav>
<div class="row">
<div class="col-sm-4">
</div>
<div class="col-sm-4">
<table class="table table-striped">
<tr>
<th>Wpis:</th>
</tr>
<tr>
<td>
<!-- Wyświetla treść wpisu, którego dotyczy wyświetlana strona -->
<?php
echo $tweet->getText();
?>
</td>
</tr>
</table>
<form role="form" action="show_tweet.php" method="post">
<div class="form-group">
<textarea name="comment_text" class="form-control" rows="2" maxlength="60"
placeholder="Wpisz treść komentarza."></textarea>
<!-- Tekst przechowywany w tej zmiennej umożliwia wyświetlanie wciąż tej samej storny, po dodaniu komentarza -->
<input type="hidden" name="tweet_text" value="<?php
echo $_GET['tweet_text'];
?>
">
</div>
<button type="submit" class="btn btn-default">Dodaj</button>