gpt4 book ai didi

php - 意外的 T_String 错误和 rss

转载 作者:行者123 更新时间:2023-11-29 04:45:14 25 4
gpt4 key购买 nike

<分区>

我是这一切的新手,希望能够让它发挥作用。

我正在尝试使用 PHP 和 Mysql 创建此 RSS 提要。

虽然我收到以下错误:

"Parse error: syntax error, unexpected T_STRING" - in line 16 which is <?xml.....

<?php

//setting the variables
$host = '';
$database = '';
$username = '';
$password = '';

//connecting to the database and server
$db_handle = mysql_connect($host, $username, $password);
$db_found = mysql_select_db($database, $db_handle);

header('Content-Type: application/xml; charset=ISO-8859-1');

?>
<?xml version="1.0" encoding="ISO-8859-1"?>

<rss version="2.0">

<channel>
<title>'.$row['title'].'</title>
<about>'.$row['about'].'</about>
<logo>'.$row['logo'].'</logo>
<website>'.$row['website'].'</website>
<phone>'.$row['phone'].'</phone>
<email>'.$row['email'].'</email>
<facebook>'.$row['facebook'].'</facebook>
<?php
$query = mysql_query("SELECT title, link, description FROM posts");

while($row = mysql_fetch_array($query)){
echo '<item>
<title>'.$row['title'].'</title>
<about>'.$row['about'].'</about>
<logo>'.$row['logo'].'</logo>
<website>'.$row['website'].'</website>
<phone>'.$row['phone'].'</phone>
<email>'.$row['email'].'</email>
<facebook>'.$row['facebook'].'</facebook>
</item>';
}
echo '
</channel></rss>';
?>

我已经尝试查看但看不到错误。

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com