<?phpinclude("conn.php");include("crop.php");mysql_select_db('hdm0910283_db', $lnk) or die ('Can\'t use hdm0910283_db : ' . mysql_error());mysql_query("SET NAMES gbk"); $sql="select * from video";$query=mysql_query($sql);$str="<thumbnails>";while ($row = mysql_fetch_array($query)) { //echo $row[imgname]; $imageurl="../workshow/images/".$row[imgname]; cutphoto("$imageurl","$imageurl",200,113); $str=$str."<thumbnail filename=\"".$row[imgname]."\" label=\"".$row[title]."\" url=\"".$row[url]. "\"/>"; //echo $row[imgname];}header("content-type:text/html; charset=utf-8"); //指定PHP使用UTF-8编码$xml = simplexml_load_file("../workshow/xml/thumbnails.xml"); //读取xml文件$str = $xml->asXML(); //标准化$xml$fp = fopen("../workshow/xml/thumbnails.xml", "w"); //新建xml文件fputs($fp, $str); //写入-------xml文件fclose($fp);?>
我就是想用PHP写一个xml文件,但后发现,每次都写完之后xml文件都没有变化,数据库读取没有问题,问题出在哪呢?
以下是xml文件,中间的label有点乱码
<?xml version="1.0"?><thumbnails><thumbnail filename="136421249467911.jpg" label="铁军-纪念长春净月高新区城市管理行政执法局成立" url="http://v.youku.com/v_show/id_XNTI5NzU4MzEy.html"/><thumbnail filename="136421346392337.jpg" label="那一年 这一年-同学会纪念" url="http://v.youku.com/v_show/id_XNTI5NjEwMzMy.html"/><thumbnail filename="136421349294580.jpg" label="松原粮食集团有限公司" url="http://v.youku.com/v_show/id_XNTI5Njk2MzQ0.html"/><thumbnail filename="136421354756516.jpg" label="生态 魅力 和谐 长白山" url="http://v.youku.com/v_show/id_XNTI5Njg1OTEy.html"/><thumbnail filename="136421359617912.jpg" label="南郡水云天3号" url="http://v.youku.com/v_show/id_XNTI5NjcyMDM2.html"/><thumbnail filename="136421362461256.jpg" label="吉林省松原农业高新技术开发区" url="http://v.youku.com/v_show/id_XNTI5NjAwNzQw.html"/><thumbnail filename="136421365264950.jpg" label="长春兴隆综合保税区" url="http://v.youku.com/v_show/id_XNTI5NTg4MDI0.html"/></thumbnails>
回复讨论(解决方案)
循环中
$str=$str."
$str = $xml->asXML();
那么,缓存的查询结果不就被覆盖了吗?

Long URLs, often cluttered with keywords and tracking parameters, can deter visitors. A URL shortening script offers a solution, creating concise links ideal for social media and other platforms. These scripts are valuable for individual websites a

Laravel simplifies handling temporary session data using its intuitive flash methods. This is perfect for displaying brief messages, alerts, or notifications within your application. Data persists only for the subsequent request by default: $request-

This is the second and final part of the series on building a React application with a Laravel back-end. In the first part of the series, we created a RESTful API using Laravel for a basic product-listing application. In this tutorial, we will be dev

Laravel provides concise HTTP response simulation syntax, simplifying HTTP interaction testing. This approach significantly reduces code redundancy while making your test simulation more intuitive. The basic implementation provides a variety of response type shortcuts: use Illuminate\Support\Facades\Http; Http::fake([ 'google.com' => 'Hello World', 'github.com' => ['foo' => 'bar'], 'forge.laravel.com' =>

The PHP Client URL (cURL) extension is a powerful tool for developers, enabling seamless interaction with remote servers and REST APIs. By leveraging libcurl, a well-respected multi-protocol file transfer library, PHP cURL facilitates efficient execution of various network protocols, including HTTP, HTTPS, and FTP. This extension offers granular control over HTTP requests, supports multiple concurrent operations, and provides built-in security features.

Do you want to provide real-time, instant solutions to your customers' most pressing problems? Live chat lets you have real-time conversations with customers and resolve their problems instantly. It allows you to provide faster service to your custom

The 2025 PHP Landscape Survey investigates current PHP development trends. It explores framework usage, deployment methods, and challenges, aiming to provide insights for developers and businesses. The survey anticipates growth in modern PHP versio

In this article, we're going to explore the notification system in the Laravel web framework. The notification system in Laravel allows you to send notifications to users over different channels. Today, we'll discuss how you can send notifications ov


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

SublimeText3 English version
Recommended: Win version, supports code prompts!

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)
