2013年(34)
分类: PHP
2013-12-05 15:02:12
01 |
$news = array( |
02 | 'title' =>'first', |
03 |
'content' =>' this is paragraph 1 ' |
04 |
.' this is paragraph 2 ' |
05 | .'Now i make a page end. [--page--] page 2 start~~~~~' |
06 | ); |
07 | $newsModel->insert($news); |
08 | ================================= |
09 | //news_detail.php?p=2 : |
10 | $news_one = $newsModel->get(1); |
11 |
12 | $content_pages = explode('[--page--]',$news_one['content']); |
13 |
14 | $cur_page = min( max(1,intval($_GET['p'])), count($content_pages) ); |
15 |
16 | $news_one['content'] = $content_pages[$cur_page-1]; |
17 |
18 | return render('news_detail.html', $news_one); |
对于文章的内部页面,可以加_1,_2这样,我觉得用数字更好些.