📄 function.get-magic-quotes-gpc.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html> <head> <title>Gets the current configuration setting of magic quotes gpc</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> </head> <body><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.get-loaded-extensions.html">get_loaded_extensions</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.get-magic-quotes-runtime.html">get_magic_quotes_runtime</a></div> <div class="up"><a href="ref.info.html">PHP Options/Info Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div><hr /><div id="function.get-magic-quotes-gpc" class="refentry"> <div class="refnamediv"> <h1 class="refname">get_magic_quotes_gpc</h1> <p class="verinfo">(PHP 4, PHP 5)</p><p class="refpurpose"><span class="refname">get_magic_quotes_gpc</span> — <span class="dc-title">Gets the current configuration setting of magic quotes gpc</span></p> </div> <div class="refsect1 description"> <h3 class="title">Description</h3> <div class="methodsynopsis dc-description"> <span class="type">int</span> <span class="methodname"><b><b>get_magic_quotes_gpc</b></b></span> ( <span class="methodparam">void</span> )</div> <p class="para rdfs-comment"> Returns the current configuration setting of <a href="info.configuration.html#ini.magic-quotes-gpc" class="link">magic_quotes_gpc</a> </p> <p class="para"> Keep in mind that the setting <a href="info.configuration.html#ini.magic-quotes-gpc" class="link"> magic_quotes_gpc</a> will not work at runtime. </p> <p class="para"> For more information about magic_quotes, see this <a href="security.magicquotes.html" class="link">security section</a>. </p> </div> <div class="refsect1 returnvalues"> <h3 class="title">Return Values</h3> <p class="para"> Returns 0 if magic quotes gpc are off, 1 otherwise. </p> </div> <div class="refsect1 examples"> <h3 class="title">Examples</h3> <p class="para"> <div class="example"> <p><b>Example #1 <b>get_magic_quotes_gpc()</b> example</b></p> <div class="example-contents"><div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB"><?php<br /></span><span style="color: #007700">echo </span><span style="color: #0000BB">get_magic_quotes_gpc</span><span style="color: #007700">(); </span><span style="color: #FF8000">// 1<br /></span><span style="color: #007700">echo </span><span style="color: #0000BB">$_POST</span><span style="color: #007700">[</span><span style="color: #DD0000">'lastname'</span><span style="color: #007700">]; </span><span style="color: #FF8000">// O\'reilly<br /></span><span style="color: #007700">echo </span><span style="color: #0000BB">addslashes</span><span style="color: #007700">(</span><span style="color: #0000BB">$_POST</span><span style="color: #007700">[</span><span style="color: #DD0000">'lastname'</span><span style="color: #007700">]); </span><span style="color: #FF8000">// O\\\'reilly<br /><br /></span><span style="color: #007700">if (!</span><span style="color: #0000BB">get_magic_quotes_gpc</span><span style="color: #007700">()) {<br /> </span><span style="color: #0000BB">$lastname </span><span style="color: #007700">= </span><span style="color: #0000BB">addslashes</span><span style="color: #007700">(</span><span style="color: #0000BB">$_POST</span><span style="color: #007700">[</span><span style="color: #DD0000">'lastname'</span><span style="color: #007700">]);<br />} else {<br /> </span><span style="color: #0000BB">$lastname </span><span style="color: #007700">= </span><span style="color: #0000BB">$_POST</span><span style="color: #007700">[</span><span style="color: #DD0000">'lastname'</span><span style="color: #007700">];<br />}<br /><br />echo </span><span style="color: #0000BB">$lastname</span><span style="color: #007700">; </span><span style="color: #FF8000">// O\'reilly<br /></span><span style="color: #0000BB">$sql </span><span style="color: #007700">= </span><span style="color: #DD0000">"INSERT INTO lastnames (lastname) VALUES ('$lastname')"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">?></span></span></code></div> </div> </div> </p> </div> <div class="refsect1 notes"> <h3 class="title">Notes</h3> <blockquote><p><b class="note">Note</b>: If the directive <a href="sybase.configuration.html#ini.magic-quotes-sybase" class="link"> magic_quotes_sybase</a> is ON it will completely override <a href="info.configuration.html#ini.magic-quotes-gpc" class="link">magic_quotes_gpc</a>. So even when <b>get_magic_quotes_gpc()</b> returns <b><tt>TRUE</tt></b> neither double quotes, backslashes or NUL's will be escaped. Only single quotes will be escaped. In this case they'll look like: <em class="emphasis">''</em> <br /> </p></blockquote> </div> <div class="refsect1 seealso"> <h3 class="title">See Also</h3> <p class="para"> <ul class="simplelist"> <li class="member"><a href="function.addslashes.html" class="function" rel="rdfs-seeAlso">addslashes()</a></li> <li class="member"><a href="function.stripslashes.html" class="function" rel="rdfs-seeAlso">stripslashes()</a></li> <li class="member"><a href="function.get-magic-quotes-runtime.html" class="function" rel="rdfs-seeAlso">get_magic_quotes_runtime()</a></li> <li class="member"><a href="function.ini-get.html" class="function" rel="rdfs-seeAlso">ini_get()</a></li> </ul> </p> </div></div><hr /><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.get-loaded-extensions.html">get_loaded_extensions</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.get-magic-quotes-runtime.html">get_magic_quotes_runtime</a></div> <div class="up"><a href="ref.info.html">PHP Options/Info Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -