Đó là một kiểm tra rất thô, bởi vì nó chấp nhận một cái gì đó như thế nào?. A_, không giống với một tên miền trong các nhỏ. Tuy nhiên, ý tưởng là để bắt các lỗi đánh máy đơn giản, chứ không phải là phấn đấu để tạo ra các PCRE hoàn hảo. như có một số các thư viện biểu thức chính quy trực tuyến. Một trong những phổ biến nhất | Simpo PDF Merge and Split Unregistered Version - http PHP OBJECT-ORIENTED SOLUTIONS Alternatively you can use the SimpleXMLElement class constructor. When used with a file it requires two extra arguments in addition to the file s path or URL like this xml new SimpleXMLElement location null true The second argument sets Libxml parameters see http manual en which are rarely used. Even though you don t normally want them the argument needs to be set to null because the third argument is required when the XML document is stored as a physical file rather than a string. The third argument is a Boolean value that needs to be set to true. There s no advantage to using the SimpleXMLElement constructor unless you need the advanced features offered by the Libxml parameters. Keep things simple by using simplexml_load_file . To access a remote file with either simplexml_load_file or the SimpleXMLElement constructor allow_url_fopen must be enabled on the server submitting the request. Loading XML from a string If the XML document is stored as a string the SimpleXMLElement constructor needs only the first argument xml new SimpleXMLElement xmlAsString Alternatively you can use the simplexml_load_string function like this xml simplexml_load_string xmlAsString Loading the XML document as a string comes in useful if allow_url_fopen is disabled. You can access the remote file with for example the Pos_RemoteConnector class from the previous chapter store the result and pass it either to the SimpleXMLElement constructor or to simplexml_load_string . For the time being though let s work with a local XML file and simplexml_load_file . As you ll see in the next chapter simplexml_load_file and simplexml_load_string can take optional arguments that make SimpleXML even more powerful so it s generally better to use them in preference to the SimpleXMLElement constructor. Creating and examining a SimpleXMLElement object This brief exercise loads