PHP Regular Solution

Source: Internet
Author: User
PHP Regular
Now, we're going to use the regular. 17



17
Simultaneous send instant SMS return results


That's what I wrote.
Preg_match ("/\ (. *) \<\/error\>/u ", $string, $state);

But the output:
Array
(
[0] = = -
[1] = 17
)

What's wrong, and I use it.
Simplexml_load_string parse This XML error, I want to use this function to take this node, but no, now only use the regular
table to help, thank you.

------Solution--------------------
1. Yes, it is.
You can use $state[1] to get the value of the error node.

2.simplexml_load_string () If there is an error. It is most likely the reason for the file BOM header or the encoding inconsistency.
------Solution--------------------
Your output is the correct
------solution--------------------
Your regular is not wrong, you take $state[1] on the line The front one ignores

You use simplexml_load_string error probably is the XML inside the newline character carriage return caused by replacing them all replace
PHP code
!--? $xml = ' 
      
     
       17 /error> 
      
        Send instant text messages synchronously to return results 
        '; $obj =simplexml_load_string (Str_replace ("\ r", " \ n "," \ T ")," ', $xml) ";p Rint_r ($obj); 
      
------Solution--------------------
$xml = simplexml_load_string ($s);
echo $xml->error;

If an error occurs because your encoding is not appropriate
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.