Home >Backend Development >PHP Tutorial >How to use PHP get_magic_quotes_gpc and addslashes
This judgment condition is often encountered in the code
magic_quotes_gpc sets whether to automatically add a backslash (and escape) before '(single quote)" (double quote) (backslash) in the data transmitted from GPC (get, post, cookie) get_magic_quotes_gpc() checks whether this item is set. If it is set, it returns true. If it is not set, it returns false If it is not set, we need to manually escape some special characters, such as ',", these three mentioned above. If you manually escape special characters? Use the addslashes('content') method. The parameter is the string that needs to be escaped. So the above code is to first check whether the system automatically adds a backslash before special characters. If not, we need to call the method addslashes() to escape the special characters in the content entered by the user. php technical issuesWelcome to join the group to discuss: 256271784, verification code: cxy, if you don’t write it, the verification will not be passed. |