我创建了一个简单的博客应用程序,其中所有内容都从数据库中检索并尝试在我的页面上进行解析.我有"主页",其中所有帖子都可见,因此我从数据库中选择所有帖子并尝试解析它们.
因此,在检索所有数据时,我将它们传递到一个数组,我最终用这个:
var_dump($feed);
Run Code Online (Sandbox Code Playgroud)
给我这个:
array(3) { [0]=> array(5) { ["url"]=> string(9) "firstpost" ["baseurl"]=> string(6) "myblog" ["title"]=> string(22) "super awesome new post" ["publish"]=> string(20) "7 Jan 2014, 10:10 am" ["content"]=> string(419) "<p>sdfasjkgasg</p> <p>asdfg</p> <p>as</p> <p>dgsdg</p> <p><strong>this bold text</strong></p> <p>this is <em>italic</em></p> <p> </p> <ol> <li><em>skata q</em></li> <li><em>skata 2</em></li> <li><em>skata 3</em></li> </ol>" } [1]=> array(5) { ["url"]=> string(6) "POST_2" ["baseurl"]=> string(6) "myblog" ["title"]=> string(7) "Title 2" ["publish"]=> string(21) "25 Dec 2013, 10:58 am" ["content"]=> string(343) "<p>This is a plain text.</p> <p><strong>Here goes …Run Code Online (Sandbox Code Playgroud)