PHP handles control-M characters (^ M)

Source: Internet
Author: User
A wrong submission problem last night left me up to two points, poor. The question of form input is that jquery dynamically joins the input node. When a form is submitted, there is no input project attached to it. I don't know how to make it happen, but it doesn't work. This is one of them. I have not tested a normal solution for the method I mentioned on the Internet, so I did not continue to use the Add section.

A wrong submission problem last night left me up to two points, poor. The question of form input is that jquery dynamically joins the input node. When a form is submitted, there is no input project attached to it. I don't know how to make it happen, but it doesn't work. This is one of them. I have not tested a normal solution for the method I mentioned on the Internet, so I did not continue to use the Add section.

A wrong submission problem last night left me up to two points, poor.

The question of form input is that jquery dynamically joins the input node. When a form is submitted, there is no input project attached to it. I don't know how to make it happen, but it doesn't work. This is one of them. I have not tested a normal solution for the method I mentioned on the Internet, so I did not continue to use the method of adding nodes.

The other is the ^ M character after the string. This may cause nginx to have a 400 Error Response and cannot process the request.

// If you are upset with windows '^ M characters at the end of the line,
// These two lines are for you:
$ Trans = array ("\ x0D" => "");
$ Text = strtr ($ orig_text, $ trans );

// Note that ctrl + M (in vim known as ^ M) is hexadecimally 0x0D



This processing method is the most concise. You can try it. The example in the php Manual

Original article address: PHP handles the control-M character (^ M), thanks to the original author for sharing.

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.