Warning: simplexml_load_file() XML
Bonjour,
Mon problème est simple.
Lors de l'utilisation de la fonction simplexml_load_file(), j'ai 3 Warnings et 2 Notices qui s'affichent.
Warning: simplexml_load_file() [function.simplexml-load-file]: test.xml:3: parser error : Opening and ending tag mismatch: user_name line 3 and username in C:\wamp\www\site gems\test.php on line 3
Warning: simplexml_load_file() [function.simplexml-load-file]: <user_name>eric</username> in C:\wamp\www\site gems\test.php on line 3
Warning: simplexml_load_file() [function.simplexml-load-file]: ^ in C:\wamp\www\site gems\test.php on line 3
Notice: Trying to get property of non-object in C:\wamp\www\site gems\test.php on line 4
Voici mon code PHP :
Code:
1 2 3 4
| if (file_exists('test.xml')) {
$xml = simplexml_load_file('test.xml');
echo $xml->server->user_password;
} |
Voici mon code XML :
Code:
1 2 3 4 5 6 7
| <?xml version="1.0"?>
<server>
<user_name>eric</username>
<user_password>ADuCdPVuZp2r67VC</user_password>
<hote>localhost</hote>
<data_base>loures</data_base>
</server> |
Je tiens à préciser que mon fichier php.ini contient "allow_url_fopen = on"
Je suis sous SEVEN, ma version de PHP est la 5.3.5 avec WAMP V2.1
Merci