开发者

How can i assign xml scripts in to a php variable?

开发者 https://www.devze.com 2023-01-04 00:25 出处:网络
I can not assign a xml scripts in to a php variable. My xml text: <?xml version=\"1.0\" encoding=\"UTF-8\" ?><rss version=\"2.0\"><channel>

I can not assign a xml scripts in to a php variable.

My xml text:

<?xml version="1.0" encoding="UTF-8" ?><rss version="2.0"><channel>
    <title>coolajax.net</title>
    <link>http://开发者_开发百科www.hotscripts.com/listings/feed</link>
    <description>Coolajax Scripts Listings Description</description>

and I want to assign this text in to $xml_header variable.

can anyone help me..


You can use HEREDOC Syntax for this:

$xml_header = <<< XML
<?xml version="1.0" encoding="UTF-8" ?><rss version="2.0"><channel>
    <title>coolajax.net</title>
    <link>http://www.hotscripts.com/listings/feed</link>
    <description>Coolajax Scripts Listings Description</description>
XML;

Just make sure you start the XML string on the next line at the first position.

0

精彩评论

暂无评论...
验证码 换一张
取 消