Answer the question
In order to leave comments, you need to log in
Why does asXML() sometimes not work in simplexml?
Simplexml_load_file('some.xml')->asXML(); works weird for me.
In some cases, everything works perfectly, and in some it displays an error 500.
That is, everything works in this code:
<?php
$login = $_POST['user'];
$xml = simplexml_load_file('online.xml');
$xml->$login->lastactiv=date("YmdHi");
$xml->$login->nlastactiv=date("Y.m.d H:i");
file_put_contents('online.xml', $xml->asXML());
?>
<?php
$title = $_POST['title'];
$email = $_POST['email'];
$name = $_POST['name'];
$tz = $_POST['timezone'];
$a = $_POST['about'];
$sms = $_POST['sendSMS'];
$st = $_POST['sendsTo'];
$xml = simplexml_load_file('some.xml');
$xml->$login->TimeZone=$tz;
$xml->$login->about=$a;
$xml->$login->sendSMS=$sms;
$xml->$login->sendsTo=$st;
file_put_contents('some.xml', $xml->asXML());
?>
$xml->asXML();
, that's it, error 500 Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question