If you look at the code below, can you find out where the error is?
Copy Code code as follows:
<?php
echo function_exists (' addcslashes ');//detect if the function exists
Echo GET_MAGIC_QUOTES_GPC (). ' <br/> '//detect whether to turn on automatic escape
echo php_version. ' <br/> ';//php version information
Echo addcslashes ("Who ' s John Adams");
Echo ' <br/> ';
$str = "Who ' s John Adams?";
echo addslashes ($STR);
?>
Does the output result the same?
10
5.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, another normal output. Why, then?
Addslashes and addcslashes are not the same function, found no, only one character difference.
But the function of two functions is the same-the escape string.
What's the difference?
Addslashes only one argument-string
Addcslashes requires two parameters, strings, delimiters.
Echo Addcslashes ("Who's John Adams", "'") so that it can be written out normally.
I hope to help you understand the usage of addslashes.
Addslashes's mistake.
Hang dad, show us a code to see if you can find errors?
Copy Code code as follows:
echo function_exists (' addcslashes ');//detect if the function exists
Echo GET_MAGIC_QUOTES_GPC (). ' <br/> '//detect whether to turn on automatic escape
echo php_version. ' <br/> ';//php version information
Echo addcslashes ("Who ' s John Adams");
Echo ' <br/> ';
$str = "Who ' s John Adams?";
echo addslashes ($STR);
Everyone guess the output is not the same??? A: Same as B: still the same
I also think the same but, in fact, pit Dad!
10
5.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, another normal output.
Why?
Addslashes and addcslashes are not the same function, found no, only one character difference.
But the function of two functions is the same-the escape string.
What is the difference?
Addslashes only one argument-string
Addcslashes requires two arguments, strings, delimiters.
Echo Addcslashes ("Who's John Adams", "'") so that it can be written out normally.