在PHP表中显示文本
我想创建一个包含3列的表,一列用于值的名称,例如“跟随者的数量”,第二列用于代码中描述的在PHP表中显示文本,php,html-table,Php,Html Table,我想创建一个包含3列的表,一列用于值的名称,例如“跟随者的数量”,第二列用于代码中描述的$tweetsimeline值,第三列用于“$tweetsimeline_2”值 我尝试过使用、和,但是我对这方面还是新手,没有得到正确的结果。有人能提供一个解决方案吗 echo "Number of Followers: ".$tweetstimeline[0]->user->followers_count; echo "<br />\n"; echo "Name of Twitte
$tweetsimeline
值,第三列用于“$tweetsimeline_2”值
我尝试过使用
、和
,但是我对这方面还是新手,没有得到正确的结果。有人能提供一个解决方案吗
echo "Number of Followers: ".$tweetstimeline[0]->user->followers_count;
echo "<br />\n";
echo "Name of Twitter Page: ".$tweetstimeline[0]->user->name;
echo "<br />\n";
echo "Location: ".$tweetstimeline[0]->user->location;
echo "<br />\n";
echo "Description: ".$tweetstimeline[0]->user->description;
echo "<br />\n";
echo "URL: ".$tweetstimeline[0]->user->url;
echo "<br />\n";
echo "Number of Friends: ".$tweetstimeline[0]->user->friends_count;
echo "<br />\n";
echo "Number of Statuses: ".$tweetstimeline[0]->user->statuses_count;
echo "<br />\n";
echo "<br />\n";
echo "Number of Followers: ".$tweetstimeline_2[0]->user->followers_count;
echo "<br />\n";
echo "Name of Twitter Page: ".$tweetstimeline_2[0]->user->name;
echo "<br />\n";
echo "Location: ".$tweetstimeline_2[0]->user->location;
echo "<br />\n";
echo "Description: ".$tweetstimeline_2[0]->user->description;
echo "<br />\n";
echo "URL: ".$tweetstimeline_2[0]->user->url;
echo "<br />\n";
echo "Number of Friends: ".$tweetstimeline_2[0]->user->friends_count;
echo "<br />\n";
echo "Number of Statuses: ".$tweetstimeline_2[0]->user->statuses_count;
echo "<br />\n";
echo "<br />\n";
echo“关注者数量:.$tweetstimeline[0]->user->Followers\u count;
回显“
\n”;
echo“Twitter页面名称:”.$tweetstimeline[0]->user->Name;
回显“
\n”;
echo“位置:”.$tweetstimeline[0]->用户->位置;
回显“
\n”;
echo“Description:”.$tweetstimeline[0]->用户->说明;
回显“
\n”;
echo“URL:.$tweetstimeline[0]->用户->URL;
回显“
\n”;
echo“好友数:”.$tweetstimeline[0]->用户->好友数;
回显“
\n”;
echo“状态数:”.$tweetstimeline[0]->用户->状态\计数;
回显“
\n”;
回显“
\n”;
echo“关注者数量:”.$tweetstimeline_2[0]->用户->关注者计数;
回显“
\n”;
echo“Twitter页面名称:”.$tweetstimeline_2[0]->用户->名称;
回显“
\n”;
echo“位置:”.$tweetstimeline_2[0]->用户->位置;
回显“
\n”;
echo“Description:”.$tweetstimeline_2[0]->用户->说明;
回显“
\n”;
echo“URL:.$tweetstimeline_2[0]->用户->URL;
回显“
\n”;
echo“好友数:”.$tweetstimeline\u 2[0]->用户->好友数;
回显“
\n”;
echo“状态数:”.$tweetstimeline_2[0]->用户->状态计数;
回显“
\n”;
回显“
\n”;
试试基本的html表格结构:
<table>
<thead>
<tr>
<th>header 1</th>
<th>header 2</th>
<th>header 3</th>
</tr>
</thead>
<tbody>
<tr>
<td>content 1</td>
<td>content 2</td>
<td>content 3</td>
</tr>
</tbody>
</table>
echo”“;
回声“;
回应“追随者数量”;
回声“$tweetstimeline”;
回声“$tweetstimeline_2”;
回声“;
回声“;
回声“100”;
回声“wtfgoesher?”;
回声“这里呢?”;
回声“;
回声“;
回声“30”;
回声“wtfgoesere”;
回声“这里呢?”;
回声“;
回声“;
回声“60”;
回声“wtfgoesere”;
回声“这里呢?”;
回声“;
回声“;
试着这样做作为起点,只要你觉得合适就做“code”+varhere+“endcode” 我认为您想要的表结构不正确。试着这样做:
<table>
<thead>
<tr>
<td># Tweetstimeline</td>
<td>Number of followers</td>
<td>Name</td>
<td>Location</td>
<td>Description</td>
<td>Url</td>
<td>Friends Count</td>
<td>Status count</td>
</tr>
</thead>
<tbody>
<?php
$rows = 2; //number of rows goes here
for($i = 0 ; $i < $rows ; $i++){
//output html row:
echo "<tr>";
echo "<td>$i</td>";
echo "<td> $tweetstimeline[$i]->user->followers_count </td>";
echo "<td> $tweetstimeline[$i]->user->name </td>";
echo "<td> $tweetstimeline[$i]->user->location </td>";
echo "<td> $tweetstimeline[$i]->user->description </td>";
echo "<td> $tweetstimeline[$i]->user->url </td>";
echo "<td> $tweetstimeline[$i]->user->friends_count </td>";
echo "<td> $tweetstimeline[$i]->user->statuses_count </td>";
echo "</tr>";
}
?>
</tbody>
</table>
#推特刺激素
追随者人数
名称
地方
描述
网址
朋友很重要
状态计数
PS:对不起我的英语,我正在学习输出的html是什么?你的tr,td,th
s是在表格中的
?没有
,
和
元素,我们可以用html谈论表格。您没有表格,只有许多行纯文本。
echo "<table style='width:100%'>";
echo "<tr>";
echo "<td>Number of Followers</td>";
echo "<td>$tweetstimeline</td> ";
echo "<td>$tweetstimeline_2</td>";
echo "</tr>";
echo "<tr>";
echo "<td>100</td>";
echo "<td>wtfgoeshere?</td>";
echo "<td>and here?</td>";
echo "</tr>";
echo "<tr>";
echo "<td>30</td>";
echo "<td>wtfgoeshere</td> ";
echo "<td>and here?</td>";
echo "</tr>";
echo "<tr>";
echo "<td>60</td>";
echo "<td>wtfgoeshere</td> ";
echo "<td>and here?</td>";
echo "</tr>";
echo "</table>";
<table>
<thead>
<tr>
<td># Tweetstimeline</td>
<td>Number of followers</td>
<td>Name</td>
<td>Location</td>
<td>Description</td>
<td>Url</td>
<td>Friends Count</td>
<td>Status count</td>
</tr>
</thead>
<tbody>
<?php
$rows = 2; //number of rows goes here
for($i = 0 ; $i < $rows ; $i++){
//output html row:
echo "<tr>";
echo "<td>$i</td>";
echo "<td> $tweetstimeline[$i]->user->followers_count </td>";
echo "<td> $tweetstimeline[$i]->user->name </td>";
echo "<td> $tweetstimeline[$i]->user->location </td>";
echo "<td> $tweetstimeline[$i]->user->description </td>";
echo "<td> $tweetstimeline[$i]->user->url </td>";
echo "<td> $tweetstimeline[$i]->user->friends_count </td>";
echo "<td> $tweetstimeline[$i]->user->statuses_count </td>";
echo "</tr>";
}
?>
</tbody>
</table>