PHP& XML [英] PHP & XML

查看:64
本文介绍了PHP& XML的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在努力为我的第三年项目做准备,基本上

包含一个动态网站,人们可以登录并创建

个人资料,也可以管理网站,以便获得统计数据

,其详细信息是irelavent。


我一直在学习php& mysql确实实现了这个项目,并且我想要&b> b&b最终产品将采用HTML格式,但我已经知道它必须是XML格式的。$ / b $ b所以现在我正在努力学习尽可能多的XML并且慢慢来来吧

来掌握它。但是我在PHP和XML之间看到的链接似乎很模糊。由于最终结果必须是XML,因此只需将PHP代码插入我的XML文档就可以直接交换,因为它与

HTML一样,或者它比这更复杂?

干杯!

I am trying to prepare for my third year project which basically
consists of a dynamic web site where people can log in and create
profiles, also being able to administer the site so that statistics
can be obtained, the details of which are irelavent.

I have been learning php & mysql do implement the project and I
"thought" the end product would be in HTML however I have since
learned it must be in XML.
So now I am trying to learn as much XML as I can and am slowly coming
to grips with it. However the link I see between PHP and XML seems
quite fuzzy. As the end result must be in XML it is just a straight
swap between inserting PHP code into my XML document as it is with
HTML or is it more complicated than that?
Cheers!

推荐答案

>我正在努力为我的第三年项目做准备,基本上
> I am trying to prepare for my third year project which basically
包含一个动态网站,人们可以登录并创建
个人资料,也可以管理网站以便统计<可以获得,其中的细节是irelavent。

我一直在学习php& mysql确实实现了这个项目,我想到了思考最终产品将采用HTML格式,但我已经知道它必须是XML格式。
所以现在我正在努力学习尽可能多的XML,并且正在慢慢地来到
来处理它。但是我在PHP和XML之间看到的链接似乎很模糊。由于最终结果必须是XML,因此只需将PHP代码插入到我的XML文档中,就像使用HTML格式一样,或者它是否比这更复杂?
干杯!
consists of a dynamic web site where people can log in and create
profiles, also being able to administer the site so that statistics
can be obtained, the details of which are irelavent.

I have been learning php & mysql do implement the project and I
"thought" the end product would be in HTML however I have since
learned it must be in XML.
So now I am trying to learn as much XML as I can and am slowly coming
to grips with it. However the link I see between PHP and XML seems
quite fuzzy. As the end result must be in XML it is just a straight
swap between inserting PHP code into my XML document as it is with
HTML or is it more complicated than that?
Cheers!



你不能拥有一个XML格式的网站。因此 - 它可以使用XML,但你需要

将其转换为HTML或格式化XML,这将是XSL。

我因此认为这个想法是以XML格式存储网站内容,

,只需使用XSL或使用PHP格式化它,使其成为正常的

HTML / XHTML页面。

无论如何,使用PHP生成XML只是将其编写为文件

,称为.xml而不是.htm(如果使用PHP生成静态页面)。

你只需要知道这些标签并确保XML格式为

,否则你会遇到各种各样的问题。我觉得最好用

写一个我需要的页面,就像普通的html / xhtml / xml或者其他什么

然后放入代码来组成那个页面PHP动态。

如果您在服务器上有XML,并希望将其读入PHP,那么将使用这些值输出到标准HTML页面然后你' '我需要使用PHP的

xml函数。我认为那是你一直在阅读的那一点。它需要一段时间才能掌握它,但我昨晚真的经历了同样的事情,因为它从未真正看过XML

文档写入它们,并在一个PHP页面中使用它们在一点点不到5美元b $ b小时内。在PHP中使用它并输出标准页面的原因意味着

它可能会有更少的问题 - 不确定在你的情况下是否会使用XML作为

。基本上,这用它来存储数据,但是你的项目可能还需要你使用它来实际提供数据,

这种情况​​你会有生成XML,然后使用XSL页面将客户端格式化为
格式。

希望这是一些帮助 - 如果你能提供一个你需要的例子

商店,您需要使用XML,以及数据库中的内容以及每页重新生成的内容,然后我可能会提供更具体的建议。 />

David


You can''t have a website "in XML" as such - it can use XML, but you need
something to convert that to html or to format the XML, which would be XSL.
I assume therefore that the idea is to store the website contents in XML,
and just format that using either XSL or using PHP to make it into a normal
HTML / XHTML page.
Anyway, generating XML with PHP is just a case of writing it as a file
called .xml instead of .htm (if you are generating static pages using PHP).
You just need to be aware of the tags and make sure the format of the XML is
right otherwise you''ll run into all sorts of problems. I find it best to
write a page of what I need just as normal html / xhtml / xml or whatever
and then put in the code to make up that page with PHP dynamically.
If you have the XML on the server, and want to read it into PHP which will
use the values to output to a standard HTML page then you''ll need to use the
xml functions of PHP. I assume thats the bit you''ve been reading up on. It
takes a while to get the hang of it, but I actually went through the same
thing last night, going from having never even really looked at an XML
document to writing them, and using them in a PHP page in a little under 5
hours. The reason for using it in PHP and outputting a standard page means
that it will have less possible problems - not sure if that would count as
using XML in your case. Basically, this uses it for storing the data, but
your project may require you to use it to actually serve the data too, in
which case you''d have to generate the XML, and then use an XSL page to
format it clientside.
Hope this is some help - if you can provide an example of what you need to
store, where you need to use XML, and what is in your database and what is
regenerated each page, then I might be able to offer more specific advice.

David


bi * ***@hotmail.com (大卫)在留言中写道:< 3e ************************** @发布。谷歌。 com> ...
bi****@hotmail.com (David) wrote in message news:<3e**************************@posting.google. com>...
我正在努力为我的第三年项目做准备,该项目基本上由一个动态网站组成,人们可以登录并创建
个人资料,能够管理网站,以便可以获得统计数据,其中的详细信息是关于我的。

我一直在学习php& mysql确实实现了这个项目,我想到了思考最终产品将采用HTML格式,但我已经知道它必须是XML格式。
所以现在我正在努力学习尽可能多的XML,并且正在慢慢地来到
来处理它。但是我在PHP和XML之间看到的链接似乎很模糊。由于最终结果必须是XML,因此只需将PHP代码插入到我的XML文档中,就像使用HTML格式一样,或者它是否比这更复杂?
干杯!
I am trying to prepare for my third year project which basically
consists of a dynamic web site where people can log in and create
profiles, also being able to administer the site so that statistics
can be obtained, the details of which are irelavent.

I have been learning php & mysql do implement the project and I
"thought" the end product would be in HTML however I have since
learned it must be in XML.
So now I am trying to learn as much XML as I can and am slowly coming
to grips with it. However the link I see between PHP and XML seems
quite fuzzy. As the end result must be in XML it is just a straight
swap between inserting PHP code into my XML document as it is with
HTML or is it more complicated than that?
Cheers!




尽管PHP主要用于直接生成HTML,但它也可以(使用当前版本)输出XML并具有此功能/>
使用XSL转换转换为HTML。有关详细信息,请参阅以下

文章:

http://www.tonymarston.net/php-mysql/domxml.html - 使用PHP的DOM XML

函数从中创建XML文件SQL数据..................................................... .tonymarston.net / php-mysql / sablotron.html - 使用PHP的

Sablotron扩展来执行XSL转换。


Tony Marston

http://www.tonymarston.net/



Although PHP is used mostly to generate HTML directly it is also
possible (with the current version) to output XML and have this
converted into HTML using an XSL transformation. See the following
articles for details:

http://www.tonymarston.net/php-mysql/domxml.html - Using PHP''s DOM XML
functions to create XML files from SQL data.

http://www.tonymarston.net/php-mysql/sablotron.html - Using PHP''s
Sablotron extension to perform XSL Transformations.

Tony Marston

http://www.tonymarston.net/


这篇关于PHP&amp; XML的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆