打印数组
我有一个从函数 $site->latestBookmarks() 返回的数组,它包含以下内容:
Array ( [0] => Array ( [url] => http://support.apple.com/kb/HT1343 [title] => Mac OS X Keyboard Shortcuts ) [1] => Array ( [url] => http://stuffkit.com/30-stunning-mixed-hq-wallpapers.htm [title] => 30 Stunning Mixed HQ Wallpapers ) )
我正在尝试打印这两个项目的标题。
<?php
// index.php
include 'classes/Site.class.php';
$site = new Site();
print_r($site->latestBookmarks());
?>
<html>
<head>
<title>Index</title>
</head>
<body>
<h1>Latest Bookmarks</h1>
<?php
while ($latestbookmarks = $site->latestBookmarks()) {
echo $latestbookmarks['title'];
}
?>
</body>
</html>
目前只是继续循环。
I have an array which is returned from the function $site->latestBookmarks() and it contains the following:
Array ( [0] => Array ( [url] => http://support.apple.com/kb/HT1343 [title] => Mac OS X Keyboard Shortcuts ) [1] => Array ( [url] => http://stuffkit.com/30-stunning-mixed-hq-wallpapers.htm [title] => 30 Stunning Mixed HQ Wallpapers ) )
I am trying to print the title of both of the items.
<?php
// index.php
include 'classes/Site.class.php';
$site = new Site();
print_r($site->latestBookmarks());
?>
<html>
<head>
<title>Index</title>
</head>
<body>
<h1>Latest Bookmarks</h1>
<?php
while ($latestbookmarks = $site->latestBookmarks()) {
echo $latestbookmarks['title'];
}
?>
</body>
</html>
At the moment is just keeps on looping.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)