Addslashes is wrong. I want to show you a code to see if you can find the error? Echo function_exists ('addcslashes'); // check whether the function echo get_magic_quotes_gpc () exists (). '<br/>'; // checks whether automatic escape echo php_version is enabled. '<br/>'; // PHP version information echo addcslashes ("Who's John Adams? "); Echo '<br/>'; $ STR =" Who's John Adams? "; Echo addslashes ($ Str); do you think the output results are the same ??? A: The same as B: I think it is the same, but it is actually a pitfall! 105.3.6 warning: addcslashes () expects exactly 2 parameters, 1 given in/data/bookuu/test/class. php on line 50 who \'s John Adams? One error and the other normal output. Why? Addslashes and addcslashes are not the same function. They are not found to have only one character. However, the functions of both functions are the same-escape strings. What is the difference? Addslashes only has one parameter-the string addcslashes requires two parameters. The string, separator. Echo addcslashes ("Who's John Adams? "," '"); In this way, the output can be normally written.
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