When I write PHP's class recently, I always encounter the error of function non object, knowing that the class is not instantiated, but I don't know where the error is.
Definition and usage
The construct () function creates a new SimpleXMLElement object.
If successful, the function returns an object. If it fails, it returns false.
Grammar
Construct (Data,options,is_url,ns,is_prefix)
| Parameters |
Description |
| Data |
Necessary. The path or URL of a well-formed XML string or XML document. |
| Options |
Optional. Specifies the additional Libxml parameters. |
| Is_url |
Optional. Specifies whether the data parameter is a URL. The default is False. |
| Ns |
Optional. |
| Is_prefix |
Optional. |
return value
Returns a SimpleXMLElement object that represents the data.
Example
<?php$xmlstring = <<<xml<?xml version= "1.0" encoding= "iso-8859-1"? ><note><to>george </to><from>john</from>
The output is similar to:
Don ' t forget the meeting! later to see construct's former _ is a, I am, last time this error, forget, now remember the function construct () {} is not function _construct () {}