本文整理汇总了PHP中Frontend::user_name_by_user_id方法的典型用法代码示例。如果您正苦于以下问题:PHP Frontend::user_name_by_user_id方法的具体用法?PHP Frontend::user_name_by_user_id怎么用?PHP Frontend::user_name_by_user_id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Frontend
的用法示例。
在下文中一共展示了Frontend::user_name_by_user_id方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Frontend
<?php
require '../php_library/class_frontend.php';
$id = 1;
if (isset($_GET['id'])) {
$id = $_GET['id'];
}
$obj = new Frontend();
$posts = $obj->select_post_from_post_table_by_user_id($id);
$username = $obj->user_name_by_user_id($id);
include 'header.php';
?>
<div class="container">
<div class="row">
<div class="col-sm-8 blog-main">
<?php
if ($posts->num_rows == 0) {
echo "<h2>No post found by this Author";
} else {
echo "<h1>Showing posts written by {$username} </h1> <hr><br>";
}
while ($post = $posts->fetch_assoc()) {
?>
<div class="blog-post">
<h2 class="blog-post-title">
<a href= "post.php?id=<?php
echo $post['id'];
?>
"><?php
echo $post['title'];
示例2:
<a href= "post.php?id=<?php
echo $post['id'];
?>
"><?php
echo $post['title'];
?>
</a>
</h2>
<p class="blog-post-meta"><?php
echo $obj->blog_time_format($post['date']);
?>
by <a href="author.php?id=<?php
echo $post['user_id'];
?>
"> <?php
echo $obj->user_name_by_user_id($post['user_id']);
?>
</a></p>
<p> <?php
echo $obj->read_more($post['post']);
?>
</p>
<P> <a href= "post.php?id=<?php
echo $post['id'];
?>
" class="btn btn-success"> Readmore </a> </P>
</div><!-- /.blog-post -->
<br>
<br>
<?php
}