有一段代码在管理面板中显示视频帖子,由于某种原因它没有显示任何新数据。所以,我想知道是否有办法显示这些帖子与最新的顶部和按日期排序所以所有新的将显示
if(!empty($post['images'])){
$images = unserialize($post['images']);
}else{
$images = array('no_image.jpg');
}
$content.= "<tr>"
. "<td>{$post['title']}</td>"
. "<td><img src='" . base_url(ltrim($images[0], "./")) ."' widht='25' height='25' /></td>"
. "<td>" . substr(strip_tags($post['content']), 0, 10) . "</td>"
. "<td>"
. "<a href='". site_url('admin/video/edit') . "/" . $post['id'] ."'>Edit</a> | "
. "<a href='". site_url('admin/video/delete') . "/" . $post['id'] ."'>Delete</a>"
. "</td>"
. "</tr>";
答案 0 :(得分:2)
你错过了$ _POST PHP全局变量。
试试这个:
if(!empty($_POST['images'])){
$images = unserialize($_POST['images']);
}else{
$images = array('no_image.jpg');
}
$content.= "<tr>"
. "<td>{$post['title']}</td>"
. "<td><img src='" . base_url(ltrim($images[0], "./")) ."' widht='25' height='25'/></td>"
. "<td>" . substr(strip_tags($_POST['content']), 0, 10) . "</td>"
. "<td>"
. "<a href='". site_url('admin/video/edit') . "/" . $_POST['id'] ."'>Edit</a> | "
. "<a href='". site_url('admin/video/delete') . "/" . $_POST['id'] ."'>Delete</a>"
. "</td>"
. "</tr>";
这会有所帮助。