Sophie

Sophie

distrib > Mandriva > 2008.1 > x86_64 > by-pkgid > 05cd670d8a02b2b4a0ffb1756f2e8308 > files > 9717

php-manual-zh-5.2.4-1mdv2008.1.noarch.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML
><HEAD
><TITLE
>sqlite_escape_string</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK
REL="HOME"
TITLE="PHP 手册"
HREF="index.html"><LINK
REL="UP"
TITLE="SQLite Functions"
HREF="ref.sqlite.html"><LINK
REL="PREVIOUS"
TITLE="sqlite_error_string"
HREF="function.sqlite-error-string.html"><LINK
REL="NEXT"
TITLE="sqlite_exec"
HREF="function.sqlite-exec.html"><META
HTTP-EQUIV="Content-type"
CONTENT="text/html; charset=UTF-8"></HEAD
><BODY
CLASS="refentry"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>PHP 手册</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="function.sqlite-error-string.html"
ACCESSKEY="P"
>上一页</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="function.sqlite-exec.html"
ACCESSKEY="N"
>下一页</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><H1
><A
NAME="function.sqlite-escape-string"
></A
>sqlite_escape_string</H1
><DIV
CLASS="refnamediv"
><A
NAME="AEN216419"
></A
><P
>    (PHP 5)</P
>sqlite_escape_string&nbsp;--&nbsp;Escapes a string for use as a query parameter</DIV
><DIV
CLASS="refsect1"
><A
NAME="AEN216422"
></A
><H2
>说明</H2
>string <B
CLASS="methodname"
>sqlite_escape_string</B
> ( string item )<BR
></BR
><P
>&#13;   <B
CLASS="function"
>sqlite_escape_string()</B
> will correctly quote the string
   specified by <CODE
CLASS="parameter"
>item</CODE
>
   for use in an SQLite SQL statement.  This includes doubling up
   single-quote characters (<TT
CLASS="literal"
>'</TT
>) and checking for
   binary-unsafe characters in the query string.
  </P
><P
>&#13;   If the <CODE
CLASS="parameter"
>item</CODE
> contains a <TT
CLASS="literal"
>NUL</TT
>
   character, or if it begins with a character whose ordinal value is
   <TT
CLASS="literal"
>0x01</TT
>, PHP will apply a binary encoding scheme so that
   you can safely store and retrieve binary data.
  </P
><P
>&#13;   Although the encoding makes it safe to insert the data, it will render
   simple text comparisons and <TT
CLASS="literal"
>LIKE</TT
> clauses in your
   queries unusable for the columns that contain the binary data.  In
   practice, this shouldn't be a problem, as your schema should be such that
   you don't use such things on binary columns (in fact, it might be better to
   store binary data using other means, such as in files).
  </P
><DIV
CLASS="warning"
><P
></P
><TABLE
CLASS="warning"
BORDER="1"
WIDTH="100%"
><TR
><TD
ALIGN="CENTER"
><B
>警告</B
></TD
></TR
><TR
><TD
ALIGN="LEFT"
><P
>&#13;    <A
HREF="function.addslashes.html"
><B
CLASS="function"
>addslashes()</B
></A
> should <SPAN
CLASS="emphasis"
><I
CLASS="emphasis"
>NOT</I
></SPAN
> be used to
    quote your strings for SQLite queries; it will lead to strange results
    when retrieving your data.
   </P
></TD
></TR
></TABLE
></DIV
><DIV
CLASS="note"
><BLOCKQUOTE
CLASS="note"
><P
><B
>注意: </B
>
    Do not use this function to encode the return values from UDF's created
    using <A
HREF="function.sqlite-create-function.html"
><B
CLASS="function"
>sqlite_create_function()</B
></A
> or
    <A
HREF="function.sqlite-create-aggregate.html"
><B
CLASS="function"
>sqlite_create_aggregate()</B
></A
> - use
    <A
HREF="function.sqlite-udf-encode-binary.html"
><B
CLASS="function"
>sqlite_udf_encode_binary()</B
></A
> instead.
   </P
></BLOCKQUOTE
></DIV
></DIV
><DIV
CLASS="refsect1"
><A
NAME="AEN216449"
></A
><H2
>参见</H2
><P
>&#13;   <P
></P
><TABLE
BORDER="0"
><TBODY
><TR
><TD
><A
HREF="function.sqlite-udf-encode-binary.html"
><B
CLASS="function"
>sqlite_udf_encode_binary()</B
></A
></TD
></TR
></TBODY
></TABLE
><P
></P
>
  </P
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="function.sqlite-error-string.html"
ACCESSKEY="P"
>上一页</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>起始页</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="function.sqlite-exec.html"
ACCESSKEY="N"
>下一页</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>sqlite_error_string</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="ref.sqlite.html"
ACCESSKEY="U"
>上一级</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>sqlite_exec</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>