PHP simplexml_load_string() ফাংশন
সংজ্ঞা ও ব্যবহার
simplexml_load_string() ফাংশন XML শব্দসারণ অবজেক্টে লোড করে।
যদি ব্যর্থ হোক, তবে false ফিরিয়ে দেয়।
语法
simplexml_load_file(string,class,options,ns,is_prefix)
parameter | description |
---|---|
string | required。ব্যবহার করতে হলে XML স্ট্রিং নির্দিষ্ট করুন。 |
class | optional。নতুন অবজেক্টের class নির্দিষ্ট করুন。 |
options | optional。Libxml এর অতিরিক্ত পারামিটারগুলি নির্দিষ্ট করুন。 |
ns | optional。 |
is_prefix | optional。 |
return value
return class SimpleXMLElement একটি অবজেক্ট যা XML ডকুমেন্টের ডাটা অবধারণ করে, ফলন করলে false রয়েছে।
উদাহরণ
<?php $xmlstring = <<<XML <?xml version="1.0" encoding="ISO-8859-1"?> <note> <to>George</to> <from>John</from> <heading>Reminder</heading> <body>Don't forget the meeting!</body> </note> XML; $xml = simplexml_load_string($xmlstring); var_dump($xml); ?>
আউটপুট:
object(SimpleXMLElement)#1 (4) { ["to"]=> string(4) "George" ["from"]=> string(4) "John" ["heading"]=> string(8) "Reminder" ["body"]=> string(29) "Don't forget the meeting!" }