Jump to content
php.lv forumi

Iekš klases izveidot jaunu memberi caur metodi.


Vebers

Recommended Posts

Nē, šķiet ka nesaprati.

 

SimpleXML ir tā, ka ielasot XML failu automātiski klasē izveidojas memberi.

 

piem., ja XML faila saturs ir:

<?xml version='1.0' standalone='yes'?>
<movies>
<movie>
 <title>PHP: Behind the Parser</title>
 <characters>
  <character>
  <name>Ms. Coder</name>
  <actor>Onlivia Actora</actor>
  </character>
  <character>
  <name>Mr. Coder</name>
  <actor>El ActÓr</actor>
  </character>
 </characters>
 <plot>
  So, this language. It's like, a programming language. Or is it a
  scripting language? All is revealed in this thrilling horror spoof
  of a documentary.
 </plot>
 <rating type="thumbs">7</rating>
 <rating type="stars">5</rating>
</movie>
</movies>

 

Un kā tas izskatās:

 

echo $xml->movie[0]->title

 

Ideja skaidra ?

Link to comment
Share on other sites

×
×
  • Create New...