[phpdoc-zh] r225 committed - 标题:[PHPDOC-ZH] [修正] ...

29 views
Skip to first unread message

phpd...@googlecode.com

unread,
Apr 9, 2012, 12:36:55 PM4/9/12
to phpd...@googlegroups.com
Revision: 225
Author: HonestQiao
Date: Mon Apr 9 09:11:24 2012
Log: 标题:[PHPDOC-ZH] [修正]
内容:
同步到官方批量修改后的版本,批量修正Revision信息,XMl文件结构等
翻译者:乔楚/HonestQiao/QQ:5601680/mail:hones...@gmail.com

http://code.google.com/p/phpdoc-zh/source/detail?r=225

Added:
/trunk/xml/appendices/about.xml
/trunk/xml/appendices/ini.core.xml
/trunk/xml/appendices/ini.list.xml
/trunk/xml/appendices/ini.sections.xml
/trunk/xml/appendices/ini.xml
/trunk/xml/appendices/migration5.xml
/trunk/xml/appendices/reserved.xml
/trunk/xml/chapters
/trunk/xml/chapters/intro.xml
/trunk/xml/chapters/tutorial.xml
/trunk/xml/faq
/trunk/xml/faq/general.xml
/trunk/xml/faq/languages.xml
/trunk/xml/faq/obtaining.xml
/trunk/xml/faq/using.xml
/trunk/xml/features/commandline.xml
/trunk/xml/features/connection-handling.xml
/trunk/xml/features/safe-mode.xml
/trunk/xml/install/ini.xml
/trunk/xml/install/pecl.xml
/trunk/xml/install/unix/apache1.xml
/trunk/xml/install/unix/commandline.xml
/trunk/xml/install/unix/debian.xml
/trunk/xml/install/windows
/trunk/xml/install/windows/building.xml
/trunk/xml/install/windows/extensions.xml
/trunk/xml/install/windows/index.xml
/trunk/xml/internals2/intro.xml
/trunk/xml/internals2/opcodes.xml
/trunk/xml/language/control-structures
/trunk/xml/language/control-structures/require.xml
/trunk/xml/language/functions.xml
/trunk/xml/language/oop5/iterations.xml
/trunk/xml/language/oop5.xml
/trunk/xml/language/operators.xml
/trunk/xml/language/types/array.xml
/trunk/xml/language/types.xml
/trunk/xml/language/variables.xml
/trunk/xml/language-snippets.ent
/trunk/xml/make_chm_index.html
/trunk/xml/reference/apache
/trunk/xml/reference/apache/functions
/trunk/xml/reference/apache/functions/apache-note.xml
/trunk/xml/reference/apache/ini.xml
/trunk/xml/reference/apd
/trunk/xml/reference/apd/ini.xml
/trunk/xml/reference/array/book.xml
/trunk/xml/reference/array/functions/array-change-key-case.xml
/trunk/xml/reference/array/functions/array-chunk.xml
/trunk/xml/reference/array/functions/array-combine.xml
/trunk/xml/reference/array/functions/array-count-values.xml
/trunk/xml/reference/array/functions/array-diff-assoc.xml
/trunk/xml/reference/array/functions/array-diff-key.xml
/trunk/xml/reference/array/functions/array-diff-uassoc.xml
/trunk/xml/reference/array/functions/array-diff-ukey.xml
/trunk/xml/reference/array/functions/array-filter.xml
/trunk/xml/reference/array/functions/array-intersect-key.xml
/trunk/xml/reference/array/functions/array-intersect-uassoc.xml
/trunk/xml/reference/array/functions/array-intersect-ukey.xml
/trunk/xml/reference/array/functions/array-keys.xml
/trunk/xml/reference/array/functions/array-map.xml
/trunk/xml/reference/array/functions/array-merge.xml
/trunk/xml/reference/array/functions/array-multisort.xml
/trunk/xml/reference/array/functions/array-pop.xml
/trunk/xml/reference/array/functions/array-product.xml
/trunk/xml/reference/array/functions/array-rand.xml
/trunk/xml/reference/array/functions/array-search.xml
/trunk/xml/reference/array/functions/array-shift.xml
/trunk/xml/reference/array/functions/array-slice.xml
/trunk/xml/reference/array/functions/array-sum.xml
/trunk/xml/reference/array/functions/array-udiff-assoc.xml
/trunk/xml/reference/array/functions/array-udiff-uassoc.xml
/trunk/xml/reference/array/functions/array-udiff.xml
/trunk/xml/reference/array/functions/array-uintersect-assoc.xml
/trunk/xml/reference/array/functions/array-uintersect-uassoc.xml
/trunk/xml/reference/array/functions/array-uintersect.xml
/trunk/xml/reference/array/functions/array-unique.xml
/trunk/xml/reference/array/functions/array-values.xml
/trunk/xml/reference/array/functions/array-walk-recursive.xml
/trunk/xml/reference/array/functions/array-walk.xml
/trunk/xml/reference/array/functions/array.xml
/trunk/xml/reference/array/functions/arsort.xml
/trunk/xml/reference/array/functions/asort.xml
/trunk/xml/reference/array/functions/each.xml
/trunk/xml/reference/array/functions/extract.xml
/trunk/xml/reference/array/functions/in-array.xml
/trunk/xml/reference/array/functions/krsort.xml
/trunk/xml/reference/array/functions/ksort.xml
/trunk/xml/reference/array/functions/natcasesort.xml
/trunk/xml/reference/array/functions/natsort.xml
/trunk/xml/reference/array/functions/rsort.xml
/trunk/xml/reference/array/functions/shuffle.xml
/trunk/xml/reference/array/functions/sort.xml
/trunk/xml/reference/array/functions/uasort.xml
/trunk/xml/reference/array/functions/uksort.xml
/trunk/xml/reference/array/functions/usort.xml
/trunk/xml/reference/bc
/trunk/xml/reference/bc/ini.xml
/trunk/xml/reference/classkit
/trunk/xml/reference/classkit/configure.xml
/trunk/xml/reference/classobj
/trunk/xml/reference/classobj/functions
/trunk/xml/reference/classobj/functions/class-exists.xml
/trunk/xml/reference/classobj/functions/get-class-methods.xml
/trunk/xml/reference/classobj/functions/get-class-vars.xml
/trunk/xml/reference/classobj/functions/get-class.xml
/trunk/xml/reference/classobj/functions/get-declared-classes.xml
/trunk/xml/reference/classobj/functions/get-declared-interfaces.xml
/trunk/xml/reference/classobj/functions/get-object-vars.xml
/trunk/xml/reference/classobj/functions/get-parent-class.xml
/trunk/xml/reference/classobj/functions/interface-exists.xml
/trunk/xml/reference/classobj/functions/is-subclass-of.xml
/trunk/xml/reference/classobj/functions/method-exists.xml
/trunk/xml/reference/classobj/functions/property-exists.xml
/trunk/xml/reference/com
/trunk/xml/reference/com/functions
/trunk/xml/reference/com/functions/com-isenum.xml
/trunk/xml/reference/com/functions/com-load-typelib.xml
/trunk/xml/reference/com/ini.xml
/trunk/xml/reference/datetime
/trunk/xml/reference/datetime/functions
/trunk/xml/reference/datetime/functions/checkdate.xml
/trunk/xml/reference/datetime/functions/date-default-timezone-get.xml
/trunk/xml/reference/datetime/functions/date-default-timezone-set.xml
/trunk/xml/reference/datetime/functions/date-sunrise.xml
/trunk/xml/reference/datetime/functions/date-sunset.xml
/trunk/xml/reference/datetime/functions/date.xml
/trunk/xml/reference/datetime/functions/getdate.xml
/trunk/xml/reference/datetime/functions/gettimeofday.xml
/trunk/xml/reference/datetime/functions/localtime.xml
/trunk/xml/reference/datetime/functions/mktime.xml
/trunk/xml/reference/datetime/functions/strftime.xml
/trunk/xml/reference/datetime/functions/strptime.xml
/trunk/xml/reference/datetime/functions/strtotime.xml
/trunk/xml/reference/datetime/functions/time.xml
/trunk/xml/reference/datetime/ini.xml
/trunk/xml/reference/dir
/trunk/xml/reference/dir/functions
/trunk/xml/reference/dir/functions/chdir.xml
/trunk/xml/reference/dir/functions/chroot.xml
/trunk/xml/reference/dir/functions/readdir.xml
/trunk/xml/reference/dir/functions/scandir.xml
/trunk/xml/reference/dotnet
/trunk/xml/reference/dotnet/functions
/trunk/xml/reference/dotnet/functions/dotnet-load.xml
/trunk/xml/reference/exif
/trunk/xml/reference/exif/functions
/trunk/xml/reference/exif/functions/exif-read-data.xml
/trunk/xml/reference/exif/ini.xml
/trunk/xml/reference/filesystem
/trunk/xml/reference/filesystem/functions
/trunk/xml/reference/filesystem/functions/chgrp.xml
/trunk/xml/reference/filesystem/functions/chmod.xml
/trunk/xml/reference/filesystem/functions/chown.xml
/trunk/xml/reference/filesystem/functions/copy.xml
/trunk/xml/reference/filesystem/functions/disk-free-space.xml
/trunk/xml/reference/filesystem/functions/disk-total-space.xml
/trunk/xml/reference/filesystem/functions/fclose.xml
/trunk/xml/reference/filesystem/functions/feof.xml
/trunk/xml/reference/filesystem/functions/fflush.xml
/trunk/xml/reference/filesystem/functions/fgetc.xml
/trunk/xml/reference/filesystem/functions/fgetcsv.xml
/trunk/xml/reference/filesystem/functions/fgets.xml
/trunk/xml/reference/filesystem/functions/fgetss.xml
/trunk/xml/reference/filesystem/functions/file-exists.xml
/trunk/xml/reference/filesystem/functions/file-get-contents.xml
/trunk/xml/reference/filesystem/functions/file-put-contents.xml
/trunk/xml/reference/filesystem/functions/file.xml
/trunk/xml/reference/filesystem/functions/fileatime.xml
/trunk/xml/reference/filesystem/functions/filectime.xml
/trunk/xml/reference/filesystem/functions/filegroup.xml
/trunk/xml/reference/filesystem/functions/fileinode.xml
/trunk/xml/reference/filesystem/functions/filemtime.xml
/trunk/xml/reference/filesystem/functions/fileowner.xml
/trunk/xml/reference/filesystem/functions/fileperms.xml
/trunk/xml/reference/filesystem/functions/filesize.xml
/trunk/xml/reference/filesystem/functions/filetype.xml
/trunk/xml/reference/filesystem/functions/flock.xml
/trunk/xml/reference/filesystem/functions/fopen.xml
/trunk/xml/reference/filesystem/functions/fpassthru.xml
/trunk/xml/reference/filesystem/functions/fputcsv.xml
/trunk/xml/reference/filesystem/functions/fstat.xml
/trunk/xml/reference/filesystem/functions/ftruncate.xml
/trunk/xml/reference/filesystem/functions/glob.xml
/trunk/xml/reference/filesystem/functions/is-dir.xml
/trunk/xml/reference/filesystem/functions/is-executable.xml
/trunk/xml/reference/filesystem/functions/is-file.xml
/trunk/xml/reference/filesystem/functions/is-link.xml
/trunk/xml/reference/filesystem/functions/is-readable.xml
/trunk/xml/reference/filesystem/functions/is-writable.xml
/trunk/xml/reference/filesystem/functions/link.xml
/trunk/xml/reference/filesystem/functions/linkinfo.xml
/trunk/xml/reference/filesystem/functions/lstat.xml
/trunk/xml/reference/filesystem/functions/mkdir.xml
/trunk/xml/reference/filesystem/functions/move-uploaded-file.xml
/trunk/xml/reference/filesystem/functions/parse-ini-file.xml
/trunk/xml/reference/filesystem/functions/pathinfo.xml
/trunk/xml/reference/filesystem/functions/popen.xml
/trunk/xml/reference/filesystem/functions/readfile.xml
/trunk/xml/reference/filesystem/functions/readlink.xml
/trunk/xml/reference/filesystem/functions/rename.xml
/trunk/xml/reference/filesystem/functions/rewind.xml
/trunk/xml/reference/filesystem/functions/rmdir.xml
/trunk/xml/reference/filesystem/functions/stat.xml
/trunk/xml/reference/filesystem/functions/symlink.xml
/trunk/xml/reference/filesystem/functions/tmpfile.xml
/trunk/xml/reference/filesystem/functions/touch.xml
/trunk/xml/reference/filesystem/functions/unlink.xml
/trunk/xml/reference/filesystem/ini.xml
/trunk/xml/reference/ftp
/trunk/xml/reference/ftp/functions
/trunk/xml/reference/ftp/functions/ftp-delete.xml
/trunk/xml/reference/ftp/functions/ftp-fget.xml
/trunk/xml/reference/ftp/functions/ftp-fput.xml
/trunk/xml/reference/ftp/functions/ftp-get.xml
/trunk/xml/reference/ftp/functions/ftp-login.xml
/trunk/xml/reference/image
/trunk/xml/reference/image/functions
/trunk/xml/reference/image/functions/getimagesize.xml
/trunk/xml/reference/image/functions/image-type-to-extension.xml
/trunk/xml/reference/image/functions/imagealphablending.xml
/trunk/xml/reference/image/functions/imageantialias.xml
/trunk/xml/reference/image/functions/imagecolorallocatealpha.xml
/trunk/xml/reference/image/functions/imagecolorclosestalpha.xml
/trunk/xml/reference/image/functions/imagecolorclosesthwb.xml
/trunk/xml/reference/image/functions/imagecolorexactalpha.xml
/trunk/xml/reference/image/functions/imagecolormatch.xml
/trunk/xml/reference/image/functions/imagecolorresolvealpha.xml
/trunk/xml/reference/image/functions/imageconvolution.xml
/trunk/xml/reference/image/functions/imagecopyresampled.xml
/trunk/xml/reference/image/functions/imagecopyresized.xml
/trunk/xml/reference/image/functions/imagecreatefromgd.xml
/trunk/xml/reference/image/functions/imagecreatefromgd2.xml
/trunk/xml/reference/image/functions/imagecreatefromgd2part.xml
/trunk/xml/reference/image/functions/imagecreatefromgif.xml
/trunk/xml/reference/image/functions/imagecreatefromjpeg.xml
/trunk/xml/reference/image/functions/imagecreatefrompng.xml
/trunk/xml/reference/image/functions/imagecreatefromstring.xml
/trunk/xml/reference/image/functions/imagecreatefromwbmp.xml
/trunk/xml/reference/image/functions/imagecreatefromxbm.xml
/trunk/xml/reference/image/functions/imagecreatefromxpm.xml
/trunk/xml/reference/image/functions/imagecreatetruecolor.xml
/trunk/xml/reference/image/functions/imageellipse.xml
/trunk/xml/reference/image/functions/imagefilledarc.xml
/trunk/xml/reference/image/functions/imagefilledellipse.xml
/trunk/xml/reference/image/functions/imagefilter.xml
/trunk/xml/reference/image/functions/imageftbbox.xml
/trunk/xml/reference/image/functions/imagefttext.xml
/trunk/xml/reference/image/functions/imagegd2.xml
/trunk/xml/reference/image/functions/imagegif.xml
/trunk/xml/reference/image/functions/imageistruecolor.xml
/trunk/xml/reference/image/functions/imagejpeg.xml
/trunk/xml/reference/image/functions/imagelayereffect.xml
/trunk/xml/reference/image/functions/imagepsbbox.xml
/trunk/xml/reference/image/functions/imagepsencodefont.xml
/trunk/xml/reference/image/functions/imagepsextendfont.xml
/trunk/xml/reference/image/functions/imagepsfreefont.xml
/trunk/xml/reference/image/functions/imagepsloadfont.xml
/trunk/xml/reference/image/functions/imagepsslantfont.xml
/trunk/xml/reference/image/functions/imagepstext.xml
/trunk/xml/reference/image/functions/imagerotate.xml
/trunk/xml/reference/image/functions/imagesavealpha.xml
/trunk/xml/reference/image/functions/imagesetstyle.xml
/trunk/xml/reference/image/functions/imagesetthickness.xml
/trunk/xml/reference/image/functions/imagetruecolortopalette.xml
/trunk/xml/reference/image/functions/imagettftext.xml
/trunk/xml/reference/image/functions/imagexbm.xml
/trunk/xml/reference/image/functions/iptcembed.xml
/trunk/xml/reference/image/functions/iptcparse.xml
/trunk/xml/reference/image/functions/jpeg2wbmp.xml
/trunk/xml/reference/image/functions/png2wbmp.xml
/trunk/xml/reference/image/ini.xml
/trunk/xml/reference/json
/trunk/xml/reference/json/functions
/trunk/xml/reference/json/functions/json-decode.xml
/trunk/xml/reference/json/functions/json-encode.xml
/trunk/xml/reference/mail
/trunk/xml/reference/mail/functions
/trunk/xml/reference/mail/functions/mail.xml
/trunk/xml/reference/mail/ini.xml
/trunk/xml/reference/math
/trunk/xml/reference/math/functions
/trunk/xml/reference/math/functions/acosh.xml
/trunk/xml/reference/math/functions/asinh.xml
/trunk/xml/reference/math/functions/atanh.xml
/trunk/xml/reference/math/functions/bindec.xml
/trunk/xml/reference/math/functions/decbin.xml
/trunk/xml/reference/math/functions/dechex.xml
/trunk/xml/reference/math/functions/decoct.xml
/trunk/xml/reference/math/functions/exp.xml
/trunk/xml/reference/math/functions/expm1.xml
/trunk/xml/reference/math/functions/log1p.xml
/trunk/xml/reference/math/functions/mt-rand.xml
/trunk/xml/reference/math/functions/mt-srand.xml
/trunk/xml/reference/math/functions/octdec.xml
/trunk/xml/reference/math/functions/pi.xml
/trunk/xml/reference/math/functions/rand.xml
/trunk/xml/reference/math/functions/sin.xml
/trunk/xml/reference/math/functions/srand.xml
/trunk/xml/reference/mysql
/trunk/xml/reference/mysql/configure.xml
/trunk/xml/reference/mysql/functions
/trunk/xml/reference/mysql/functions/mysql-affected-rows.xml
/trunk/xml/reference/mysql/functions/mysql-client-encoding.xml
/trunk/xml/reference/mysql/functions/mysql-close.xml
/trunk/xml/reference/mysql/functions/mysql-connect.xml
/trunk/xml/reference/mysql/functions/mysql-create-db.xml
/trunk/xml/reference/mysql/functions/mysql-data-seek.xml
/trunk/xml/reference/mysql/functions/mysql-db-name.xml
/trunk/xml/reference/mysql/functions/mysql-drop-db.xml
/trunk/xml/reference/mysql/functions/mysql-fetch-array.xml
/trunk/xml/reference/mysql/functions/mysql-fetch-assoc.xml
/trunk/xml/reference/mysql/functions/mysql-fetch-field.xml
/trunk/xml/reference/mysql/functions/mysql-fetch-object.xml
/trunk/xml/reference/mysql/functions/mysql-fetch-row.xml
/trunk/xml/reference/mysql/functions/mysql-field-name.xml
/trunk/xml/reference/mysql/functions/mysql-field-type.xml
/trunk/xml/reference/mysql/functions/mysql-free-result.xml
/trunk/xml/reference/mysql/functions/mysql-select-db.xml
/trunk/xml/reference/mysql/ini.xml
/trunk/xml/reference/oci8
/trunk/xml/reference/oci8/configure.xml
/trunk/xml/reference/oci8/functions
/trunk/xml/reference/oci8/functions/oci-bind-by-name.xml
/trunk/xml/reference/oci8/functions/oci-cancel.xml
/trunk/xml/reference/oci8/functions/oci-close.xml
/trunk/xml/reference/oci8/functions/oci-commit.xml
/trunk/xml/reference/oci8/functions/oci-connect.xml
/trunk/xml/reference/oci8/functions/oci-execute.xml
/trunk/xml/reference/oci8/functions/oci-fetch-all.xml
/trunk/xml/reference/oci8/functions/oci-fetch.xml
/trunk/xml/reference/oci8/functions/oci-free-statement.xml
/trunk/xml/reference/oci8/functions/oci-new-connect.xml
/trunk/xml/reference/oci8/functions/oci-password-change.xml
/trunk/xml/reference/oci8/functions/oci-pconnect.xml
/trunk/xml/reference/oci8/functions/oci-result.xml
/trunk/xml/reference/oci8/functions/oci-rollback.xml
/trunk/xml/reference/oci8/functions/oci-set-prefetch.xml
/trunk/xml/reference/outcontrol/ini.xml
/trunk/xml/reference/pgsql
/trunk/xml/reference/pgsql/functions
/trunk/xml/reference/pgsql/functions/pg-close.xml
/trunk/xml/reference/pgsql/functions/pg-connection-reset.xml
/trunk/xml/reference/pgsql/functions/pg-convert.xml
/trunk/xml/reference/pgsql/functions/pg-copy-from.xml
/trunk/xml/reference/pgsql/functions/pg-delete.xml
/trunk/xml/reference/pgsql/functions/pg-end-copy.xml
/trunk/xml/reference/pgsql/functions/pg-fetch-row.xml
/trunk/xml/reference/pgsql/functions/pg-free-result.xml
/trunk/xml/reference/pgsql/functions/pg-insert.xml
/trunk/xml/reference/pgsql/functions/pg-last-notice.xml
/trunk/xml/reference/pgsql/functions/pg-lo-export.xml
/trunk/xml/reference/pgsql/functions/pg-lo-import.xml
/trunk/xml/reference/pgsql/functions/pg-lo-unlink.xml
/trunk/xml/reference/pgsql/functions/pg-meta-data.xml
/trunk/xml/reference/pgsql/functions/pg-pconnect.xml
/trunk/xml/reference/pgsql/functions/pg-put-line.xml
/trunk/xml/reference/pgsql/functions/pg-select.xml
/trunk/xml/reference/pgsql/functions/pg-update.xml
/trunk/xml/reference/pgsql/ini.xml
/trunk/xml/reference/regex
/trunk/xml/reference/regex/functions
/trunk/xml/reference/regex/functions/spliti.xml
/trunk/xml/reference/regex/functions/sql-regcase.xml
/trunk/xml/reference/session
/trunk/xml/reference/session/functions
/trunk/xml/reference/session/functions/session-is-registered.xml
/trunk/xml/reference/session/ini.xml
/trunk/xml/reference/snmp
/trunk/xml/reference/snmp/functions
/trunk/xml/reference/snmp/functions/snmprealwalk.xml
/trunk/xml/reference/spl
/trunk/xml/reference/spl/book.xml
/trunk/xml/reference/spl/functions
/trunk/xml/reference/spl/functions/iterator-apply.xml
/trunk/xml/reference/spl/functions/iterator-count.xml
/trunk/xml/reference/spl/functions/iterator-to-array.xml
/trunk/xml/reference/spl/functions/spl-autoload-register.xml
/trunk/xml/reference/spl/functions/spl-classes.xml
/trunk/xml/reference/spl/functions/spl-object-hash.xml
/trunk/xml/reference/strings/functions/chop.xml
/trunk/xml/reference/strings/functions/chr.xml
/trunk/xml/reference/strings/functions/chunk-split.xml
/trunk/xml/reference/strings/functions/convert-cyr-string.xml
/trunk/xml/reference/strings/functions/count-chars.xml
/trunk/xml/reference/strings/functions/explode.xml
/trunk/xml/reference/url
/trunk/xml/reference/url/functions
/trunk/xml/reference/url/functions/base64-decode.xml
/trunk/xml/reference/url/functions/base64-encode.xml
/trunk/xml/reference/url/functions/get-headers.xml
/trunk/xml/reference/url/functions/parse-url.xml
/trunk/xml/reference/url/functions/rawurlencode.xml
/trunk/xml/reference/url/functions/urlencode.xml
/trunk/xml/reference/var
/trunk/xml/reference/var/functions
/trunk/xml/reference/var/functions/empty.xml
/trunk/xml/reference/var/functions/is-callable.xml
/trunk/xml/reference/var/functions/isset.xml
/trunk/xml/reference/var/functions/settype.xml
/trunk/xml/reference/var/functions/unserialize.xml
/trunk/xml/reference/var/functions/unset.xml
/trunk/xml/reference/var/functions/var-dump.xml
/trunk/xml/reference/var/ini.xml
/trunk/xml/reference/w32api
/trunk/xml/reference/w32api/functions
/trunk/xml/reference/w32api/functions/w32api-deftype.xml
/trunk/xml/reference/w32api/functions/w32api-init-dtype.xml
/trunk/xml/reference/w32api/functions/w32api-invoke-function.xml
/trunk/xml/reference/w32api/functions/w32api-register-function.xml
/trunk/xml/reference/w32api/functions/w32api-set-call-method.xml
/trunk/xml/reference/xml
/trunk/xml/reference/xml/configure.xml
/trunk/xml/reference/xml/functions
/trunk/xml/reference/xml/functions/xml-parse.xml
/trunk/xml/reference/xml/functions/xml-set-character-data-handler.xml
/trunk/xml/reference/xml/functions/xml-set-default-handler.xml
/trunk/xml/reference/xml/functions/xml-set-element-handler.xml
/trunk/xml/reference/xml/functions/xml-set-end-namespace-decl-handler.xml
/trunk/xml/reference/xml/functions/xml-set-external-entity-ref-handler.xml
/trunk/xml/reference/xml/functions/xml-set-notation-decl-handler.xml

/trunk/xml/reference/xml/functions/xml-set-processing-instruction-handler.xml
/trunk/xml/reference/xml/functions/xml-set-start-namespace-decl-handler.xml
/trunk/xml/reference/xml/functions/xml-set-unparsed-entity-decl-handler.xml
/trunk/xml/reference/xml/setup.xml
/trunk/xml/reference/xmlrpc
/trunk/xml/reference/xmlrpc/functions
/trunk/xml/reference/xmlrpc/functions/xmlrpc-decode-request.xml
/trunk/xml/reference/xmlrpc/functions/xmlrpc-decode.xml
/trunk/xml/reference/xmlrpc/functions/xmlrpc-encode-request.xml
/trunk/xml/reference/xmlrpc/functions/xmlrpc-encode.xml
/trunk/xml/reference/xmlrpc/functions/xmlrpc-get-type.xml
/trunk/xml/reference/xmlrpc/functions/xmlrpc-parse-method-descriptions.xml

/trunk/xml/reference/xmlrpc/functions/xmlrpc-server-add-introspection-data.xml
/trunk/xml/reference/xmlrpc/functions/xmlrpc-server-call-method.xml
/trunk/xml/reference/xmlrpc/functions/xmlrpc-server-create.xml
/trunk/xml/reference/xmlrpc/functions/xmlrpc-server-destroy.xml

/trunk/xml/reference/xmlrpc/functions/xmlrpc-server-register-introspection-callback.xml
/trunk/xml/reference/xmlrpc/functions/xmlrpc-server-register-method.xml
/trunk/xml/reference/xmlrpc/functions/xmlrpc-set-type.xml
/trunk/xml/security
/trunk/xml/security/globals.xml
/trunk/xml/security/magicquotes.xml
Modified:
/trunk/xml/appendices/migration53.xml
/trunk/xml/features/gc.xml
/trunk/xml/install/fpm/configuration.xml
/trunk/xml/install/fpm/index.xml
/trunk/xml/install/fpm/install.xml
/trunk/xml/install/macos/bundled.xml
/trunk/xml/install/unix/apache2.xml
/trunk/xml/internals2/pdo/index.xml
/trunk/xml/internals2/pdo/preparation.xml
/trunk/xml/internals2/pdo/prerequisites.xml
/trunk/xml/internals2/ze1/index.xml
/trunk/xml/internals2/ze1/intro.xml
/trunk/xml/internals2/ze1/zendapi/intro.xml
/trunk/xml/internals2/ze1/zendapi/overview.xml
/trunk/xml/language/oop5/inheritance.xml
/trunk/xml/language/oop5/late-static-bindings.xml
/trunk/xml/language/oop5/properties.xml
/trunk/xml/language/oop5/references.xml
/trunk/xml/language/oop5/serialization.xml
/trunk/xml/language/oop5/static.xml
/trunk/xml/language/oop5/typehinting.xml
/trunk/xml/language/predefined/arrayaccess/offsetexists.xml
/trunk/xml/language/predefined/arrayaccess/offsetget.xml
/trunk/xml/language/predefined/arrayaccess/offsetset.xml
/trunk/xml/language/predefined/arrayaccess/offsetunset.xml
/trunk/xml/language/predefined/arrayaccess.xml
/trunk/xml/language/predefined/errorexception.xml
/trunk/xml/language/predefined/exception/clone.xml
/trunk/xml/language/predefined/exception/construct.xml
/trunk/xml/language/predefined/exception/getcode.xml
/trunk/xml/language/predefined/exception/getfile.xml
/trunk/xml/language/predefined/exception/getline.xml
/trunk/xml/language/predefined/exception/getmessage.xml
/trunk/xml/language/predefined/exception/getprevious.xml
/trunk/xml/language/predefined/exception/gettrace.xml
/trunk/xml/language/predefined/exception/gettraceasstring.xml
/trunk/xml/language/predefined/exception/tostring.xml
/trunk/xml/language/predefined/exception.xml
/trunk/xml/language/predefined/exceptions.xml
/trunk/xml/language/predefined/interfaces.xml
/trunk/xml/language/predefined/iterator/current.xml
/trunk/xml/language/predefined/iterator/key.xml
/trunk/xml/language/predefined/iterator/next.xml
/trunk/xml/language/predefined/iterator/rewind.xml
/trunk/xml/language/predefined/iterator/valid.xml
/trunk/xml/language/predefined/iterator.xml
/trunk/xml/language/predefined/iteratoraggregate/getiterator.xml
/trunk/xml/language/predefined/iteratoraggregate.xml
/trunk/xml/language/predefined/serializable/serialize.xml
/trunk/xml/language/predefined/serializable/unserialize.xml
/trunk/xml/language/predefined/serializable.xml
/trunk/xml/language/predefined/traversable.xml
/trunk/xml/language/predefined/variables/argc.xml
/trunk/xml/language/predefined/variables/argv.xml
/trunk/xml/language/predefined/variables/cookie.xml
/trunk/xml/language/predefined/variables/env.xml
/trunk/xml/language/predefined/variables/files.xml
/trunk/xml/language/predefined/variables/get.xml
/trunk/xml/language/predefined/variables/globals.xml
/trunk/xml/language/predefined/variables/httprawpostdata.xml
/trunk/xml/language/predefined/variables/httpresponseheader.xml
/trunk/xml/language/predefined/variables/phperrormsg.xml
/trunk/xml/language/predefined/variables/post.xml
/trunk/xml/language/predefined/variables/request.xml
/trunk/xml/language/predefined/variables/server.xml
/trunk/xml/language/predefined/variables/session.xml
/trunk/xml/language/predefined/variables/superglobals.xml
/trunk/xml/language/predefined/variables.xml
/trunk/xml/language/types/string.xml
/trunk/xml/reference/apc/apciterator.xml
/trunk/xml/reference/apc/book.xml
/trunk/xml/reference/apc/constants.xml
/trunk/xml/reference/apc/functions/apc-add.xml
/trunk/xml/reference/apc/functions/apc-clear-cache.xml
/trunk/xml/reference/apc/functions/apc-exists.xml
/trunk/xml/reference/apc/functions/apc-fetch.xml
/trunk/xml/reference/apc/functions/apc-store.xml
/trunk/xml/reference/apc/ini.xml
/trunk/xml/reference/apc/setup.xml
/trunk/xml/reference/apc/versions.xml
/trunk/xml/reference/array/functions/array-fill-keys.xml
/trunk/xml/reference/array/functions/array-replace-recursive.xml
/trunk/xml/reference/array/functions/array-replace.xml
/trunk/xml/reference/calendar/book.xml
/trunk/xml/reference/calendar/functions/cal-days-in-month.xml
/trunk/xml/reference/calendar/functions/cal-from-jd.xml
/trunk/xml/reference/calendar/functions/cal-info.xml
/trunk/xml/reference/calendar/functions/cal-to-jd.xml
/trunk/xml/reference/calendar/functions/easter-date.xml
/trunk/xml/reference/calendar/functions/easter-days.xml
/trunk/xml/reference/calendar/functions/frenchtojd.xml
/trunk/xml/reference/calendar/functions/gregoriantojd.xml
/trunk/xml/reference/calendar/functions/jddayofweek.xml
/trunk/xml/reference/calendar/functions/jdmonthname.xml
/trunk/xml/reference/calendar/functions/jdtofrench.xml
/trunk/xml/reference/calendar/functions/jdtogregorian.xml
/trunk/xml/reference/calendar/functions/jdtojewish.xml
/trunk/xml/reference/calendar/functions/jdtojulian.xml
/trunk/xml/reference/calendar/functions/jdtounix.xml
/trunk/xml/reference/calendar/functions/jewishtojd.xml
/trunk/xml/reference/calendar/functions/juliantojd.xml
/trunk/xml/reference/calendar/functions/unixtojd.xml
/trunk/xml/reference/calendar/reference.xml
/trunk/xml/reference/calendar/setup.xml
/trunk/xml/reference/calendar/versions.xml
/trunk/xml/reference/curl/book.xml
/trunk/xml/reference/curl/configure.xml
/trunk/xml/reference/curl/constants.xml
/trunk/xml/reference/curl/examples.xml
/trunk/xml/reference/curl/functions/curl-close.xml
/trunk/xml/reference/curl/functions/curl-copy-handle.xml
/trunk/xml/reference/curl/functions/curl-errno.xml
/trunk/xml/reference/curl/functions/curl-error.xml
/trunk/xml/reference/curl/functions/curl-exec.xml
/trunk/xml/reference/curl/functions/curl-getinfo.xml
/trunk/xml/reference/curl/functions/curl-init.xml
/trunk/xml/reference/curl/functions/curl-multi-add-handle.xml
/trunk/xml/reference/curl/functions/curl-multi-close.xml
/trunk/xml/reference/curl/functions/curl-multi-exec.xml
/trunk/xml/reference/curl/functions/curl-multi-getcontent.xml
/trunk/xml/reference/curl/functions/curl-multi-info-read.xml
/trunk/xml/reference/curl/functions/curl-multi-init.xml
/trunk/xml/reference/curl/functions/curl-multi-remove-handle.xml
/trunk/xml/reference/curl/functions/curl-multi-select.xml
/trunk/xml/reference/curl/functions/curl-setopt-array.xml
/trunk/xml/reference/curl/functions/curl-setopt.xml
/trunk/xml/reference/curl/functions/curl-version.xml
/trunk/xml/reference/curl/reference.xml
/trunk/xml/reference/curl/setup.xml
/trunk/xml/reference/curl/versions.xml
/trunk/xml/reference/errorfunc/book.xml
/trunk/xml/reference/errorfunc/constants.xml
/trunk/xml/reference/errorfunc/examples.xml
/trunk/xml/reference/errorfunc/ini.xml
/trunk/xml/reference/errorfunc/reference.xml
/trunk/xml/reference/info/book.xml
/trunk/xml/reference/info/functions/set-time-limit.xml
/trunk/xml/reference/info/reference.xml
/trunk/xml/reference/info/setup.xml
/trunk/xml/reference/info/versions.xml
/trunk/xml/reference/memcache/book.xml
/trunk/xml/reference/memcache/configure.xml
/trunk/xml/reference/memcache/constants.xml
/trunk/xml/reference/memcache/examples.xml
/trunk/xml/reference/memcache/functions/memcache-debug.xml
/trunk/xml/reference/memcache/ini.xml
/trunk/xml/reference/memcache/memcache/add.xml
/trunk/xml/reference/memcache/memcache/addserver.xml
/trunk/xml/reference/memcache/memcache/close.xml
/trunk/xml/reference/memcache/memcache/connect.xml
/trunk/xml/reference/memcache/memcache/decrement.xml
/trunk/xml/reference/memcache/memcache/delete.xml
/trunk/xml/reference/memcache/memcache/flush.xml
/trunk/xml/reference/memcache/memcache/get.xml
/trunk/xml/reference/memcache/memcache/getextendedstats.xml
/trunk/xml/reference/memcache/memcache/getserverstatus.xml
/trunk/xml/reference/memcache/memcache/getstats.xml
/trunk/xml/reference/memcache/memcache/getversion.xml
/trunk/xml/reference/memcache/memcache/increment.xml
/trunk/xml/reference/memcache/memcache/pconnect.xml
/trunk/xml/reference/memcache/memcache/replace.xml
/trunk/xml/reference/memcache/memcache/set.xml
/trunk/xml/reference/memcache/memcache/setcompressthreshold.xml
/trunk/xml/reference/memcache/memcache/setserverparams.xml
/trunk/xml/reference/memcache/memcache.xml
/trunk/xml/reference/memcache/reference.xml
/trunk/xml/reference/memcache/setup.xml
/trunk/xml/reference/memcache/versions.xml
/trunk/xml/reference/memcached/book.xml
/trunk/xml/reference/memcached/callbacks.xml
/trunk/xml/reference/memcached/configure.xml
/trunk/xml/reference/memcached/constants.xml
/trunk/xml/reference/memcached/expiration.xml
/trunk/xml/reference/memcached/memcached/add.xml
/trunk/xml/reference/memcached/memcached/addbykey.xml
/trunk/xml/reference/memcached/memcached/addserver.xml
/trunk/xml/reference/memcached/memcached/addservers.xml
/trunk/xml/reference/memcached/memcached/append.xml
/trunk/xml/reference/memcached/memcached/appendbykey.xml
/trunk/xml/reference/memcached/memcached/cas.xml
/trunk/xml/reference/memcached/memcached/casbykey.xml
/trunk/xml/reference/memcached/memcached/construct.xml
/trunk/xml/reference/memcached/memcached/decrement.xml
/trunk/xml/reference/memcached/memcached/delete.xml
/trunk/xml/reference/memcached/memcached/deletebykey.xml
/trunk/xml/reference/memcached/memcached/fetch.xml
/trunk/xml/reference/memcached/memcached/fetchall.xml
/trunk/xml/reference/memcached/memcached/flush.xml
/trunk/xml/reference/memcached/memcached/get.xml
/trunk/xml/reference/memcached/memcached/getbykey.xml
/trunk/xml/reference/memcached/memcached/getdelayed.xml
/trunk/xml/reference/memcached/memcached/getdelayedbykey.xml
/trunk/xml/reference/memcached/memcached/getmulti.xml
/trunk/xml/reference/memcached/memcached/getmultibykey.xml
/trunk/xml/reference/memcached/memcached/getoption.xml
/trunk/xml/reference/memcached/memcached/getresultcode.xml
/trunk/xml/reference/memcached/memcached/getresultmessage.xml
/trunk/xml/reference/memcached/memcached/getserverbykey.xml
/trunk/xml/reference/memcached/memcached/getserverlist.xml
/trunk/xml/reference/memcached/memcached/getstats.xml
/trunk/xml/reference/memcached/memcached/getversion.xml
/trunk/xml/reference/memcached/memcached/increment.xml
/trunk/xml/reference/memcached/memcached/prepend.xml
/trunk/xml/reference/memcached/memcached/prependbykey.xml
/trunk/xml/reference/memcached/memcached/replace.xml
/trunk/xml/reference/memcached/memcached/replacebykey.xml
/trunk/xml/reference/memcached/memcached/set.xml
/trunk/xml/reference/memcached/memcached/setbykey.xml
/trunk/xml/reference/memcached/memcached/setmulti.xml
/trunk/xml/reference/memcached/memcached/setmultibykey.xml
/trunk/xml/reference/memcached/memcached/setoption.xml
/trunk/xml/reference/memcached/memcached.xml
/trunk/xml/reference/memcached/memcachedexception.xml
/trunk/xml/reference/memcached/sessions.xml
/trunk/xml/reference/memcached/setup.xml
/trunk/xml/reference/memcached/versions.xml
/trunk/xml/reference/misc/ini.xml
/trunk/xml/reference/mysqli/book.xml
/trunk/xml/reference/mysqli/configure.xml
/trunk/xml/reference/mysqli/constants.xml
/trunk/xml/reference/mysqli/functions/mysqli-bind-param.xml
/trunk/xml/reference/mysqli/functions/mysqli-bind-result.xml
/trunk/xml/reference/mysqli/functions/mysqli-client-encoding.xml
/trunk/xml/reference/mysqli/functions/mysqli-connect.xml
/trunk/xml/reference/mysqli/functions/mysqli-disable-reads-from-master.xml
/trunk/xml/reference/mysqli/functions/mysqli-disable-rpl-parse.xml
/trunk/xml/reference/mysqli/functions/mysqli-enable-reads-from-master.xml
/trunk/xml/reference/mysqli/functions/mysqli-enable-rpl-parse.xml
/trunk/xml/reference/mysqli/functions/mysqli-escape-string.xml
/trunk/xml/reference/mysqli/functions/mysqli-execute.xml
/trunk/xml/reference/mysqli/functions/mysqli-fetch.xml
/trunk/xml/reference/mysqli/functions/mysqli-get-cache-stats.xml
/trunk/xml/reference/mysqli/functions/mysqli-get-metadata.xml
/trunk/xml/reference/mysqli/functions/mysqli-master-query.xml
/trunk/xml/reference/mysqli/functions/mysqli-param-count.xml
/trunk/xml/reference/mysqli/functions/mysqli-report.xml
/trunk/xml/reference/mysqli/functions/mysqli-rpl-parse-enabled.xml
/trunk/xml/reference/mysqli/functions/mysqli-rpl-probe.xml
/trunk/xml/reference/mysqli/functions/mysqli-rpl-query-type.xml
/trunk/xml/reference/mysqli/functions/mysqli-send-long-data.xml
/trunk/xml/reference/mysqli/functions/mysqli-send-query.xml
/trunk/xml/reference/mysqli/functions/mysqli-set-opt.xml
/trunk/xml/reference/mysqli/functions/mysqli-slave-query.xml
/trunk/xml/reference/mysqli/ini.xml
/trunk/xml/reference/mysqli/mysqli.xml
/trunk/xml/reference/mysqli/mysqli_driver.xml
/trunk/xml/reference/mysqli/mysqli_result.xml
/trunk/xml/reference/mysqli/mysqli_stmt.xml
/trunk/xml/reference/mysqli/mysqli_warning.xml
/trunk/xml/reference/mysqli/overview.xml
/trunk/xml/reference/mysqli/persistconns.xml
/trunk/xml/reference/mysqli/reference.xml
/trunk/xml/reference/mysqli/setup.xml
/trunk/xml/reference/mysqli/summary.xml
/trunk/xml/reference/mysqli/versions.xml
/trunk/xml/reference/pcntl/book.xml
/trunk/xml/reference/pcntl/configure.xml
/trunk/xml/reference/pcntl/constants.xml
/trunk/xml/reference/pcntl/examples.xml
/trunk/xml/reference/pcntl/functions/pcntl-alarm.xml
/trunk/xml/reference/pcntl/functions/pcntl-exec.xml
/trunk/xml/reference/pcntl/functions/pcntl-fork.xml
/trunk/xml/reference/pcntl/functions/pcntl-getpriority.xml
/trunk/xml/reference/pcntl/functions/pcntl-setpriority.xml
/trunk/xml/reference/pcntl/functions/pcntl-signal-dispatch.xml
/trunk/xml/reference/pcntl/functions/pcntl-signal.xml
/trunk/xml/reference/pcntl/functions/pcntl-sigprocmask.xml
/trunk/xml/reference/pcntl/functions/pcntl-sigtimedwait.xml
/trunk/xml/reference/pcntl/functions/pcntl-sigwaitinfo.xml
/trunk/xml/reference/pcntl/functions/pcntl-wait.xml
/trunk/xml/reference/pcntl/functions/pcntl-waitpid.xml
/trunk/xml/reference/pcntl/functions/pcntl-wexitstatus.xml
/trunk/xml/reference/pcntl/functions/pcntl-wifexited.xml
/trunk/xml/reference/pcntl/functions/pcntl-wifsignaled.xml
/trunk/xml/reference/pcntl/functions/pcntl-wifstopped.xml
/trunk/xml/reference/pcntl/functions/pcntl-wstopsig.xml
/trunk/xml/reference/pcntl/functions/pcntl-wtermsig.xml
/trunk/xml/reference/pcntl/reference.xml
/trunk/xml/reference/pcntl/setup.xml
/trunk/xml/reference/pcntl/versions.xml
/trunk/xml/reference/pcre/book.xml
/trunk/xml/reference/pcre/constants.xml
/trunk/xml/reference/pcre/examples.xml
/trunk/xml/reference/pcre/functions/preg-filter.xml
/trunk/xml/reference/pcre/functions/preg-last-error.xml
/trunk/xml/reference/pcre/functions/preg-match-all.xml
/trunk/xml/reference/pcre/functions/preg-replace-callback.xml
/trunk/xml/reference/pcre/functions/preg-replace.xml
/trunk/xml/reference/pcre/ini.xml
/trunk/xml/reference/pcre/pattern.differences.xml
/trunk/xml/reference/pcre/pattern.modifiers.xml
/trunk/xml/reference/pcre/pattern.posix.xml
/trunk/xml/reference/pcre/pattern.syntax.xml
/trunk/xml/reference/pcre/pattern.xml
/trunk/xml/reference/pcre/reference.xml
/trunk/xml/reference/pcre/setup.xml
/trunk/xml/reference/pcre/versions.xml
/trunk/xml/reference/sphinx/book.xml
/trunk/xml/reference/sphinx/configure.xml
/trunk/xml/reference/sphinx/examples.xml
/trunk/xml/reference/sphinx/sphinxclient/close.xml
/trunk/xml/reference/sphinx/sphinxclient/open.xml
/trunk/xml/reference/sphinx/sphinxclient/query.xml
/trunk/xml/reference/sphinx/sphinxclient/setarrayresult.xml
/trunk/xml/reference/sphinx/sphinxclient/setfilter.xml
/trunk/xml/reference/sphinx/sphinxclient/setlimits.xml
/trunk/xml/reference/sphinx/sphinxclient/setmatchmode.xml
/trunk/xml/reference/sphinx/sphinxclient/setserver.xml
/trunk/xml/reference/sphinx/sphinxclient.xml
/trunk/xml/reference/strings/book.xml
/trunk/xml/reference/strings/constants.xml
/trunk/xml/reference/strings/functions/convert-uudecode.xml
/trunk/xml/reference/strings/functions/convert-uuencode.xml
/trunk/xml/reference/strings/functions/crypt.xml
/trunk/xml/reference/strings/functions/echo.xml
/trunk/xml/reference/strings/functions/fprintf.xml
/trunk/xml/reference/strings/functions/get-html-translation-table.xml
/trunk/xml/reference/strings/functions/hebrev.xml
/trunk/xml/reference/strings/functions/hebrevc.xml
/trunk/xml/reference/strings/functions/md5-file.xml
/trunk/xml/reference/strings/functions/md5.xml
/trunk/xml/reference/strings/functions/nl2br.xml
/trunk/xml/reference/strings/functions/ord.xml
/trunk/xml/reference/strings/functions/print.xml
/trunk/xml/reference/strings/functions/printf.xml
/trunk/xml/reference/strings/functions/rtrim.xml
/trunk/xml/reference/strings/functions/sha1-file.xml
/trunk/xml/reference/strings/functions/sha1.xml
/trunk/xml/reference/strings/functions/similar-text.xml
/trunk/xml/reference/strings/functions/str-getcsv.xml
/trunk/xml/reference/strings/functions/str-ireplace.xml
/trunk/xml/reference/strings/functions/str-pad.xml
/trunk/xml/reference/strings/functions/str-repeat.xml
/trunk/xml/reference/strings/functions/str-replace.xml
/trunk/xml/reference/strings/functions/str-rot13.xml
/trunk/xml/reference/strings/functions/str-shuffle.xml
/trunk/xml/reference/strings/functions/str-split.xml
/trunk/xml/reference/strings/functions/str-word-count.xml
/trunk/xml/reference/strings/functions/strcasecmp.xml
/trunk/xml/reference/strings/functions/strcmp.xml
/trunk/xml/reference/strings/functions/strcoll.xml
/trunk/xml/reference/strings/functions/strcspn.xml
/trunk/xml/reference/strings/functions/strip-tags.xml
/trunk/xml/reference/strings/functions/stripcslashes.xml
/trunk/xml/reference/strings/functions/stripos.xml
/trunk/xml/reference/strings/functions/stripslashes.xml
/trunk/xml/reference/strings/functions/stristr.xml
/trunk/xml/reference/strings/functions/strlen.xml
/trunk/xml/reference/strings/functions/strnatcasecmp.xml
/trunk/xml/reference/strings/functions/strnatcmp.xml
/trunk/xml/reference/strings/functions/strncasecmp.xml
/trunk/xml/reference/strings/functions/strncmp.xml
/trunk/xml/reference/strings/functions/strpbrk.xml
/trunk/xml/reference/strings/functions/strpos.xml
/trunk/xml/reference/strings/functions/strrchr.xml
/trunk/xml/reference/strings/functions/strrev.xml
/trunk/xml/reference/strings/functions/strripos.xml
/trunk/xml/reference/strings/functions/strrpos.xml
/trunk/xml/reference/strings/functions/strspn.xml
/trunk/xml/reference/strings/functions/strstr.xml
/trunk/xml/reference/strings/functions/strtok.xml
/trunk/xml/reference/strings/functions/strtolower.xml
/trunk/xml/reference/strings/functions/strtoupper.xml
/trunk/xml/reference/strings/functions/strtr.xml
/trunk/xml/reference/strings/functions/substr-compare.xml
/trunk/xml/reference/strings/functions/substr-count.xml
/trunk/xml/reference/strings/functions/substr-replace.xml
/trunk/xml/reference/strings/functions/substr.xml
/trunk/xml/reference/strings/functions/trim.xml
/trunk/xml/reference/strings/functions/ucfirst.xml
/trunk/xml/reference/strings/functions/ucwords.xml
/trunk/xml/reference/strings/functions/vfprintf.xml
/trunk/xml/reference/strings/functions/vprintf.xml
/trunk/xml/reference/strings/functions/vsprintf.xml
/trunk/xml/reference/strings/functions/wordwrap.xml
/trunk/xml/reference/strings/reference.xml
/trunk/xml/reference/strings/setup.xml
/trunk/xml/reference/strings/versions.xml

=======================================
--- /dev/null
+++ /trunk/xml/appendices/about.xml Mon Apr 9 09:11:24 2012
@@ -0,0 +1,388 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- $Revision: 324974 $ -->
+<!-- EN-Revision: 310569 Maintainer: HonestQiao Status: ready -->
+<!-- Reviewed: no Maintainer: HonestQiao -->
+<!-- CREDITS: dallas -->
+<appendix xml:id="about" xmlns="http://docbook.org/ns/docbook"
xmlns:xlink="http://www.w3.org/1999/xlink">
+ <title>关于本手册</title>
+
+ <sect1 xml:id="about.formats">
+ <title>手册的格式</title>
+ <para>
+ 《PHP 参考手册》提供了多种不同格式的版本,它们可以分为两组:在线阅读版本
和可下载包。
+ </para>
+ <note>
+ <para>
+ 有些出版商可能已经出版了本手册的一些印刷版本,但不推荐使用它们,因为
+ PHP 参考手册更新得非常快,这些印刷版本的内容很快将过时。
+ </para>
+ </note>
+ <para>
+ 可以访问 <link xlink:href="&url.php;">PHP.net 网站</link>及其众多的镜像
站点来在线阅读《PHP
+ 参考手册》。为了保证最佳的访问速度,应该选择地理位置最接近的镜像站点。
PHP
+ 手册的 HTML 版本既有纯 HTML 版(便于打印的),也有看上去和感觉上和
+ PHP 站点上的手册一样的版本。
+ </para>
+ <para>
+ 和绝大多数离线格式的手册相比,在线阅读版本有两个显著的优点,即它集成了
<link
+ linkend="about.notes">用户注释</link>,并且可以使用其中的
+ <link xlink:href="&url.php.urlhowto;">URL
+ 快捷方式</link>快速进入手册中想阅读的部分;但是,它的明显的缺点是必须保
持一直在线来阅读。
+ </para>
+ <para>
+ 目前,《PHP
+ 参考手册》提供多种离线阅读格式,最适合于自己的格式取决于所使用的操作系统
和个人的阅读习惯。关于《PHP
+ 参考手册》如何被制作成如此多的版本,请查阅本附录中"如何生成手册的各种格
式"一节。
+ </para>
+ <para>
+ 跨平台性最好的格式是 HTML 格式格式。HTML 格式提供了两种方式:一种只有一
个很大的
+ HTML 文件;另一种方式是每一节分成一个独立文件,它们形成一个包含有几千个
文件的文件包。我们提供的是这两种版本的压缩包,需要使用解压缩工具解压出压缩包
中的文件。
+ </para>
+ <!--
+ PDF 版的 PHP 手册"目前"不可用,也许以后有一天会有的。
+ <para>
+ 另一种流行的跨平台格式,也是最适合打印的格式,是 PDF(也就是 Adobe
+ Acrobat)格式。不过,需要提醒您本手册超过 2000 页,并且还在不断地被修
订。
+ </para>
+ <note>
+ <para>
+ 有很多软件可以阅读 <acronym>PDF</acronym> 文件,例如
+ <link xlink:href="&url.adobe.acrobat;">Adobe Acrobat Reader</link>。
+ </para>
+ </note>
+ -->
+ <para>
+ 对于 Windows 平台,我们利用了 <productname>Windows
+ 的超文本帮助</productname>应用程序结合本手册的 HTML
+ 格式,形成了本手册的 <productname>Windows
+ 超文本帮助</productname>版本。该版本提供手册的全文搜索、完整的索引以及书
签功能。很多
+ Windows 平台下流行的 PHP
+ 集成开发环境也集成了该版本的手册,以给开发者提供最方便快捷的参考。CHM
+ 阅读器也有 Linux 版本,可以到 <link xlink:href="&url.xchm;">xCHM</link>
+ 或 <link xlink:href="&url.gnochm;">GnoCHM</link> 网站了解更多信息。
+ </para>
+
+ <para>
+ 同时,PHP 手册也有<link xlink:href="&url.php.echm;">扩展 CHM
+ 版本</link>提供下载。它更新的速度比较慢,但是提供了附加的功能。由于制作
帮助页面时采用的技术的特殊性,它只可在
+ <productname>Microsoft Windows</productname> 下工作。
+ </para>
+ </sect1>
+
+ <sect1 xml:id="about.notes">
+ <title>关于用户注释</title>
+ <para>
+ 用户注释在本手册的开发过程中搬演了相当重要的角色。通过允许手册的读者利用
它们的浏览器提供范例、解释和进一步的阐述,我们便能够把这些反馈信息包含到手册
的正文中。而且,当这些注释被包含后,读者就可以在线通过它们被提交的格式来阅读
它们,也可以通过某些离线格式来阅读。
+ </para>
+ <note>
+ <para>
+ 用户注释在网上出现之前并不成熟,因此这些文字和代码的质量,甚至它们的真
实性无从得到保证。(这并不是说本手册本身的质量和准确性没有任何的保证。)
+ </para>
+ </note>
+ <note>
+ <para>
+ 由于用户注释被认为是 PHP 手册的一部分,因此它也被保护本文档的许可协议
(目前为开放出版许可协议)所保护。请查阅手册<link
+ linkend="copyright">版权页</link>以了解更多详细信息。
+ </para>
+ </note>
+ </sect1>
+
+ <sect1 xml:id="about.prototypes">
+ <title>如何阅读函数的定义(函数原型)</title>
+ <para>
+ 文档中的每个函数都只是快速参考,学会如何阅读和理解文档将使得
+ PHP 的使用更加简单。和依赖赖于复制/粘贴范例比起来,用户一定更希望知道如
何阅读函数的定义(函数原型):
+ </para>
+ <note>
+ <title>
+ 先决条件,对<link linkend="language.types">变量类型</link>的基本理解
+ </title>
+ <para>
+ 尽管 PHP 是亚类型语言,但对<link
+ linkend="language.types">变量类型</link>有一个基本的理解也是非常重要
的,因为它们有重要的意义。
+ </para>
+ </note>
+ <para>
+ 函数定义告诉我们函数<link
+ linkend="functions.returning-values">返回</link>什么类型的值,让我们用函

+ <function>strlen</function> 的定义作为第一个范例:
+ </para>
+ <para>
+ <screen role="html">
+<![CDATA[
+strlen
+
+(PHP 3, PHP 4, PHP 5)
+strlen -- 获取字符串长度
+
+描述
+int strlen ( string str )
+
+返回字符串的长度。
+]]>
+ </screen>
+ </para>
+ <para>
+ <table>
+ <title>函数定义</title>
+ <tgroup cols="2">
+ <thead>
+ <row>
+ <entry>组成部分</entry>
+ <entry>说明</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>
+ strlen
+ </entry>
+ <entry>
+ 函数名称
+ </entry>
+ </row>
+ <row>
+ <entry>
+ (PHP 3, PHP 4, PHP 5)
+ </entry>
+ <entry>
+ strlen() 在 PHP 3 、PHP 4 和 PHP 5 中都存在
+ </entry>
+ </row>
+ <row>
+ <entry>
+ int
+ </entry>
+ <entry>
+ 该函数返回的值的类型,这里为<type>整型</type>。(例如,字符串的长度
是以数字来衡量的)
+ </entry>
+ </row>
+ <row>
+ <entry>
+ ( string str )
+ </entry>
+ <entry>
+ 第一个(本例中是唯一的)参数,在该函数中名为
<parameter>str</parameter>,且类型为 <type>string</type>。
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ </para>
+ <para>
+ 可以将以上函数的定义写成一般形式:
+ </para>
+ <para>
+ <screen>
+<![CDATA[
+返回类型 函数名 ( 参数类型 参数名 )
+]]>
+ </screen>
+ </para>
+ <para>
+ 很多函数都有多个变量,例如 <function>in_array</function>。其函数原型如
下:
+ </para>
+ <para>
+ <screen>
+<![CDATA[
+bool in_array ( mixed needle, array haystack [, bool strict])
+]]>
+ </screen>
+ </para>
+ <para>
+ 这是什么意思?<function>in_array</function>
+ 返回一个"<link linkend="language.types.boolean">布尔</link>"值,成功(如
果在参数
+ <parameter>haystack</parameter> 中能找到参数
+ <parameter>needle</parameter>)则返回 &true;
+ &return.falseforfailure;(如果在参数 <parameter>haystack</parameter> 中
找不到参数
+ <parameter>needle</parameter>)则返回 &false;。第一个参数被命名为
+ <parameter>needle</parameter> 且其<link
+ linkend="language.types">类型</link>不定,因此我们将其称为"<emphasis>混
和</emphasis>"类型。该混和类型的
+ <parameter>needle</parameter> 参数(我们要找的对象)可以适一个标量的值
(字符串、整数、或者<link
+ linkend="language.types.float">浮点数</link>),或者一个<link
+ linkend="language.types.array">数组</link>。
<parameter>haystack</parameter>(我们寻找的范围)是第二个参数。第三个
<emphasis>可选</emphasis>参数被命名为
+ <parameter>strict</parameter>。所有的可选参数都用
+ <emphasis>[</emphasis> 方括号 <emphasis>]</emphasis> 括起来。手册表明
+ <parameter>strict</parameter> 参数默认值为布尔值
+ &false;。需要了解函数工作的细节,请参阅手册中和该函数相关的页面。
+ </para>
+ <para>
+ 有的函数包含更复杂的 PHP 版本信息。我们拿
+ <function>html_entity_decode</function> 举例:
+ </para>
+ <para>
+ <screen>
+<![CDATA[
+(PHP 4 >= 4.3.0, PHP 5)
+]]>
+ </screen>
+ </para>
+ <para>
+ 它意味着该函数不可在 PHP 3 中使用,只可在 PHP 4.3.0 及以后发布的版本中使
用。
+ </para>
+ </sect1>
+
+ <sect1 xml:id="about.phpversions">
+ <title>本手册中所涉及的 PHP 版本</title>
+ <para>
+ 本文档包含有 PHP 4 和 PHP 5 有关的内容,以及一些关于 PHP 3 移植和兼容的
注意事项。PHP
+ 不同版本之间的行为、参数、返回值和其它改变都以"注意"的形式加入了本手册的
正文。
+ </para>
+ <para>
+ 有部分 SVN 版的 PHP 文档。SVN 版是最新开发的版本,但尚未发布,只能通过
+ SVN 或者 <link xlink:href="&url.php.snapshots;">snapshot</link>
+ 来获得。所以要注意标注有"仅在 SVN 版可用"的特性通常还不可用。但这些特性
很可能会出现在
+ PHP 下一个稳定版本中。要下载 SVN 版本,请查看
+ <link xlink:href="&url.php.anonsvn;">SVN 的匿名访问</link>。
+ </para>
+ <para>
+ 还有可能遇到一些文档仅适用于尚未发布的 PHP 版本(例如 PHP 5.0.0,而当前
最新的稳定版本是
+ 4.3.x)。多数情况下,这并不是文档中的错误,我们经常在文档中加入一些目前
版本尚未支持的特性描述,但这些特性将在未来某一个确定的
+ PHP 版本中实现。一般来说,PHP 仅在发布主要版本的时候增加新功能,而其他情
况只是
+ bug 的修正。版本号使用 A.B.C 的格式,发布主要版本时,A 或 B
+ 数值增加,而发布次要版本时,C 数值增加。因此,若当前只发布了
+ PHP x.0.x,但是手册中出现 x.1.x
+ 的功能描述,这并不奇怪。但也请注意,手册是为现在写的,不是为将来写的。
+ </para>
+ <para>
+ PHP 手册会多次列出 PHP 配置选项的"默认值"。这些默认值是基于没有
&php.ini; 配置文件的,
+ 所以与<filename>php.ini-development</filename> 和
<filename>php.ini-production</filename>存在很大差异。同时这些值也是基于最新
版本的
+ PHP。请参考 <link linkend="ini.list">PHP 配置选项列表</link>以了解更多信
息。
+ </para>
+ </sect1>
+
+ <sect1 xml:id="about.more">
+ <title>如何得到关于 PHP 更多的信息</title>
+ <para>
+ 本手册并不打算提供基本的编程开发指导。刚学编程的或者新手程序员会发现仅仅
用本手册来学习如何用
+ PHP 编程是一件很困难的事情。应该寻找一本更适合初学者的书。
+ </para>
+ <para>
+ 目前,PHP 官方提供了许多邮件列表来讨论 PHP
+ 编程相关的各个方面的问题。如果卡在了某个问题上,可以到该邮件列表寻求帮
助。有关支持以及邮件列表请访问
+ <link xlink:href="&url.php.support;">PHP.net 支持页面</link>。此外,在
+ <link xlink:href="&url.php.links;">PHP.net 链接页面</link>有一个关于 PHP
+ 相关网站的列表,在这些网站中可以找到和 PHP 相关的文章、论坛和代码。
+ </para>
+ </sect1>
+
+ <sect1 xml:id="about.howtohelp">
+ <title>如何帮助改进本文档</title>
+ <para>
+ 可以通过以下三种途径来帮助改善本文档。
+ </para>
+ <para>
+ 如果发现本手册任何一个格式的版本中有错误,请通过设在
+ <link xlink:href="&url.php.bugs;">&url.php.bugs;</link>
+ 的纠错系统向我们报告,并将提交的错误分类为"文档问题 (Documentation
+ Problem)"。所有文档相关的问题,包括手册格式,都应作为错误提交。
+ </para>
+ <note>
+ <para>
+ 请勿滥用纠错系统来寻求帮助。如需帮助请访问<link
+ xlink:href="&url.php.support;">支持页面</link>。
+ </para>
+ </note>
+ <para>
+ 通过提交注释,用户可以向其它读者提供更多的范例、解释和阐述。但请勿在注释
系统提交错误报告。更多细节见<link
+ linkend="about.notes">关于用户注释</link>一节。
+ </para>
+ <para>
+ PHP 手册被翻译成很多种语言。如果懂英语和另一种语言,可以加入翻译团队来帮
助改善文档。有关开始一个新语言版本的翻译或者加入某一个语言版本的翻译工作,请
下载并阅读
+ <link xlink:href="&url.php.dochowto;">&url.php.dochowto;</link>。
+ </para>
+ <para>
+ 该文档的简体中文版可在
+ <link xlink:href="&url.php.dochowto-zh;">&url.php.dochowto-zh;</link> 下
载。
+ </para>
+ <para>
+ PHP 文档项目也有一个 IRC 频道,许多手册作者都常去。可以访问
+ <literal>irc.freenode.net</literal> 服务器上的
+ <literal>#phpdoc</literal> 与他们讨论改善 PHP 文档的方法。
+ </para>
+
+ </sect1>
+
+ <sect1 xml:id="about.generate">
+ <title>如何生成手册的各种格式</title>
+ <para>
+ 本手册使用 <acronym>XML</acronym> 语言编写,同时运用了
+ <link xlink:href="&url.docbook.xml;">DocBook XML DTD</link>。还用了
+ <link
+ xlink:href="&url.phd;"><acronym>PhD</acronym></link> (基于 [PH]P 的
+ [D]ocBook 渲染器) 来控制格式。
+ </para>
+ <para>
+ 将 <acronym>XML</acronym>
+ 语言作为源文件格式,使得我们只需维护该源文件文档,就可以可以利用它生成许
多其它的输出格式。
+ 生在在线手册格式的工具是<link
+ xlink:href="&url.phd;">PhD</link>。我们使用
+ <link xlink:href="&url.winhelp;">Microsoft HTML Help Workshop</link>
+ 来生成本手册的 Windows 超文本帮助格式。当然,PHP 本身也完成了其它一些转
换和格式化工作。
+ </para>
+ <para>
+ PHP 手册被生成多种不同语言和格式,详情见
+ <link xlink:href="&url.php.docs;">&url.php.docs;</link>。
<acronym>XML</acronym>
+ 源代码可以通过 SVN 下载,并通过
+ <link xlink:href="&url.php.svn;">&url.php.svn;</link>
+ 在线浏览。文档存放于 <literal>phpdoc</literal> 模块中。
+ </para>
+ </sect1>
+
+ <sect1 xml:id="about.translations">
+ <title>手册译文</title>
+ <para>
+ 《PHP 参考手册》不但有各种不同的格式,而且还有各种语言的版本。手册的正文
最初是用英语撰写的,后来有来自全世界各地的工作组致力于本手册各种语言版本的翻
译工作。如果某个函数或者章节的内容尚未被翻译,则该语言版本手册的发布将落后于
英语版本。
+ </para>
+ <para>
+ 翻译工作者首先从本手册的 <acronym>XML</acronym>
+ 源代码(可于 <link xlink:href="&url.php.svn;">&url.php.svn;</link>
+ 获取)入手,将这些源代码翻译成他们的母语。<emphasis>不要</emphasis>从生
成后的
+ <acronym>HTML</acronym> 或纯文本版入手。是由编译系统负责将
+ <acronym>XML</acronym> 源代码转换成可阅读版本。
+ </para>
+ <note>
+ <para>
+ 要帮忙翻译手册,请发一封空的电子邮件到
+ <link
xlink:href="mailto:&email.php.doc.subscribe;">&email.php.doc.subscribe;</link>
+ 加入 phpdoc 邮件列表以便与文档翻译小组取得联系。邮件列表的地址为
+ <literal>&email.php.doc;</literal>。请在电子邮件中声明对文档翻译工作感
兴趣,有人会回复并帮助加入到已经存在的翻译小组,或者开始新语种的翻译工作。
+ </para>
+ </note>
+ <para>
+ 目前,本手册已经(或部分)有下列语种的译文:巴西葡萄牙语、简体中文、繁体
中文、繁体中文(香港)、捷克语、丹麦语、芬兰语、法语、德语、希腊语、希伯来
语、匈牙利语、意大利语、日语、朝鲜语、波兰语、罗马尼亚语、俄语、斯洛伐克语、
斯洛文尼亚语、西班牙语、瑞典语和土耳其语。
+ </para>
+ <para>
+ 可以访问 <link xlink:href="&url.php.docs;">&url.php.docs;</link> 来下载
各种版本。
+ </para>
+ <!-- 下一段为 Dallas 添加 -->
+ <para>
+ 有志于加入 PHP 手册简体中文翻译工作的朋友,首先请详细阅读<link
+
xlink:href="http://svn.php.net/viewvc/phpdoc/zh/trunk/readme.first?view=markup">此
文章</link>。有任何问题请向
+ PHP 文档中文邮件列表提出。
+ </para>
+ <!-- Dallas 添加部分结束 -->
+ </sect1>
+
+</appendix>
+
+<!-- Keep this comment at the end of the file
+Local variables:
+mode: sgml
+sgml-omittag:t
+sgml-shorttag:t
+sgml-minimize-attributes:nil
+sgml-always-quote-attributes:t
+sgml-indent-step:1
+sgml-indent-data:t
+indent-tabs-mode:nil
+sgml-parent-document:nil
+sgml-default-dtd-file:"~/.phpdoc/manual.ced"
+sgml-exposed-tags:nil
+sgml-local-catalogs:nil
+sgml-local-ecat-files:nil
+End:
+vim600: syn=xml fen fdm=syntax fdl=2 si
+vim: et tw=78 syn=sgml
+vi: ts=1 sw=1
+-->
=======================================
--- /dev/null
+++ /trunk/xml/appendices/ini.core.xml Mon Apr 9 09:11:24 2012
@@ -0,0 +1,1844 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- $Revision: 324974 $ -->
+<!-- EN-Revision: 324591 Maintainer: HonestQiao Status: ready -->
+<!-- Reviewed: no Maintainer: HonestQiao -->
+<section xml:id="ini.core" xmlns="http://docbook.org/ns/docbook"
xmlns:xlink="http://www.w3.org/1999/xlink">
+ <title>&php.ini; 核心配置选项说明</title>
+ <para>
+ 该列表只包含核心的 &php.ini;
+ 配置选项。扩展的配置选项在各个扩展的文档页面分别被描述。有关 session 的
选项可以在
+ <link linkend="ref.session">sessions 页面</link>找到。
+ </para>
+
+ <section xml:id="ini.sect.httpd-options">
+ <title>Httpd 选项</title>
+ <para>
+ <table>
+ <title>Httpd 选项</title>
+ <tgroup cols="4">
+ <thead>
+ <row>
+ <entry>&Name;</entry>
+ <entry>&Default;</entry>
+ <entry>&Changeable;</entry>
+ <entry>&Changelog;</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>async_send</entry>
+ <entry>"0"</entry>
+ <entry>PHP_INI_ALL</entry>
+ <entry></entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ </para>
+ <para>
+ </para>
+ </section>
+
+ <section xml:id="ini.sect.language-options">
+ <title>语言选项</title>
+ <para>
+ <table>
+ <title>语言和杂类配置选项</title>
+ <tgroup cols="4">
+ <thead>
+ <row>
+ <entry>&Name;</entry>
+ <entry>&Default;</entry>
+ <entry>&Changeable;</entry>
+ <entry>&Changelog;</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry><link
linkend="ini.short-open-tag">short_open_tag</link></entry>
+ <entry>"1"</entry>
+ <entry>PHP_INI_ALL</entry>
+ <entry>在 PHP 4.0.0 时是 PHP_INI_ALL。 在 PHP &lt; 5.3.0 时是
PHP_INI_PERDIR。</entry>
+ </row>
+ <row>
+ <entry><link linkend="ini.asp-tags">asp_tags</link></entry>
+ <entry>"0"</entry>
+ <entry>PHP_INI_PERDIR</entry>
+ <entry>在 PHP 4.0.0 时是 PHP_INI_ALL。</entry>
+ </row>
+ <row>
+ <entry><link linkend="ini.precision">precision</link></entry>
+ <entry>"14"</entry>
+ <entry>PHP_INI_ALL</entry>
+ <entry></entry>
+ </row>
+ <row>
+ <entry><link
linkend="ini.serialize-precision">serialize_precision</link></entry>
+ <entry>"17"</entry>
+ <entry>PHP_INI_ALL</entry>
+ <entry>从 PHP 4.3.2 起可用。在 PHP 5.3.5以前,默认值为 100 </entry>
+ </row>
+ <row>
+ <entry><link
linkend="ini.y2k-compliance">y2k_compliance</link></entry>
+ <entry>"1"</entry>
+ <entry>PHP_INI_ALL</entry>
+ <entry>在 PHP 5.4.0 中移除该选项。</entry>
+ </row>
+ <row>
+ <entry><link
linkend="ini.allow-call-time-pass-reference">allow_call_time_pass_reference</link></entry>
+ <entry>"1"</entry>
+ <entry>PHP_INI_PERDIR</entry>
+ <entry>在 PHP 4.0.0 时是 PHP_INI_ALL。 在 PHP 5.4.0 中移除该选项。
</entry>
+ </row>
+ <row>
+ <entry><link
linkend="ini.disable-functions">disable_functions</link></entry>
+ <entry>""</entry>
+ <entry>&php.ini; only</entry>
+ <entry>从 PHP 4.0.1 起可用。</entry>
+ </row>
+ <row>
+ <entry><link
linkend="ini.disable-classes">disable_classes</link></entry>
+ <entry>""</entry>
+ <entry>&php.ini; only</entry>
+ <entry>从 PHP 4.3.2 起可用。</entry>
+ </row>
+ <row>
+ <entry><link
linkend="ini.exit-on-timeout">exit_on_timeout</link></entry>
+ <entry>""</entry>
+ <entry>PHP_INI_ALL</entry>
+ <entry>从 PHP 5.3.0 起可用。</entry>
+ </row>
+ <row>
+ <entry><link linkend="ini.expose-php">expose_php</link></entry>
+ <entry>"1"</entry>
+ <entry>&php.ini; only</entry>
+ <entry></entry>
+ </row>
+ <row>
+ <entry><link
linkend="ini.zend.multibyte">zend.multibyte</link></entry>
+ <entry>"0"</entry>
+ <entry>PHP_INI_ALL</entry>
+ <entry>从 PHP 5.4.0 起可用</entry>
+ </row>
+ <row>
+ <entry><link
linkend="ini.zend.script-encoding">zend.script_encoding</link></entry>
+ <entry>NULL</entry>
+ <entry>PHP_INI_ALL</entry>
+ <entry>从 PHP 5.4.0 起可用</entry>
+ </row>
+ <row>
+ <entry><link
linkend="ini.zend.signal-check">zend.signal_check</link></entry>
+ <entry>"0"</entry>
+ <entry>PHP_INI_SYSTEM</entry>
+ <entry>从 PHP 5.4.0 起可用</entry>
+ </row>
+ <row>
+ <entry><link
linkend="ini.zend.ze1-compatibility-mode">zend.ze1_compatibility_mode</link></entry>
+ <entry>"0"</entry>
+ <entry>PHP_INI_ALL</entry>
+ <entry>从 PHP 5.0.0起可用。 在 PHP 5.3.0 中移除该选项 </entry>
+ </row>
+ <row>
+ <entry><link
linkend="ini.detect-unicode">detect_unicode</link></entry>
+ <entry>"1"</entry>
+ <entry>PHP_INI_ALL</entry>
+ <entry>从 PHP 5.1.0起可用。 &removed.php.future; </entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ </para>
+
+ &ini.descriptions.title;
+
+ <para>
+ <variablelist>
+ <varlistentry xml:id="ini.short-open-tag">
+ <term>
+ <parameter>short_open_tag</parameter>
+ <type>boolean</type>
+ </term>
+ <listitem>
+ <para>
+ 决定是否允许使用 PHP 代码开始标志的缩写形式(<userinput>&lt;?
+ ?&gt;</userinput>)。如果要和 XML 结合使用
+ PHP,可以禁用此选项以便于嵌入使用
+ <userinput>&lt;?xml ?&gt;</userinput>。否则还可以通过
+ PHP 来输出,例如:<userinput>&lt;?php echo '&lt;?xml
+ version="1.0"'; ?&gt;</userinput>。如果禁用了,必须使用
+ PHP 代码开始标志的完整形式(<userinput>&lt;?php
+ ?&gt;</userinput>)。
+ </para>
+ <note>
+ <para>
+ 本指令也会影响到缩写形式
+ <userinput>&lt;?=</userinput>,它和
+ <userinput>&lt;? echo</userinput> 等价。使用此缩写需要
+ <systemitem role="directive">short_open_tag</systemitem>
+ 的值为 On。
+ 从 PHP 5.4.0 起, <userinput>&lt;?=</userinput> 总是可用的。
+ </para>
+ </note>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry xml:id="ini.asp-tags">
+ <term>
+ <parameter>asp_tags</parameter>
+ <type>boolean</type>
+ </term>
+ <listitem>
+ <simpara>
+ 除了通常的
+ &lt;?php ?&gt;
+ 标志之外还允许使用
+ ASP 风格的标志 &lt;% %&gt;。这也包括了输出变量值的缩写
+ &lt;%= $value %&gt;。更多信息见<link
+ linkend="language.basic-syntax.phpmode">从 HTML 中分离</link>一
节。
+ </simpara>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry xml:id="ini.precision">
+ <term>
+ <parameter>precision</parameter>
+ <type>integer</type>
+ </term>
+ <listitem>
+ <simpara>
+ 浮点数中显示有效数字的位数。
+ </simpara>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry xml:id="ini.serialize-precision">
+ <term>
+ <parameter>serialize_precision</parameter>
+ <type>integer</type>
+ </term>
+ <listitem>
+ <simpara>
+ The number of significant digits stored while serializing floating
point numbers.
+ </simpara>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry xml:id="ini.y2k-compliance">
+ <term>
+ <parameter>y2k_compliance</parameter>
+ <type>boolean</type>
+ </term>
+ <listitem>
+ <simpara>
+ 强制 2000 年兼容(在不兼容的浏览器中会出问题)。
+ </simpara>
+ </listitem>
+ </varlistentry>
+
+
+ <varlistentry xml:id="ini.allow-call-time-pass-reference">
+ <term>
+ <parameter>allow_call_time_pass_reference</parameter>
+ <type>boolean</type>
+ </term>
+ <listitem>
+ <para>
+ 在函数调用时参数被按照引用传递时是否发出警告。此方法已不被赞成并在
+ PHP/Zend 未来的版本中很可能不再支持。鼓励使用的方法是在函数定义中
指定哪些参数应该用引用传递。鼓励大家尝试关闭此选项并确保脚本能够正常运行,以
确保该脚本也能在未来的版本中运行(每次使用此特性都会收到一条警告)。
+ </para>
+ <para>
+ 在函数调用时通过引用传递参数是不推荐的,因为它影响到了代码的整洁。
如果函数的参数没有声明作为引用传递,函数可以通过未写入文档的方法修改其参数。
要避免其副作用,最好仅在函数声明时指定那个参数需要通过引用传递。
+ </para>
+ <para>
+ 参见<link linkend="language.references">引用的解释</link>。
+ </para>
+ <para>
+ <table>
+ <title>Changelog for
<literal>allow_call_time_pass_reference</literal></title>
+ <tgroup cols="2">
+ <thead>
+ <row>
+ <entry>&Version;</entry>
+ <entry>&Description;</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>5.4.0</entry>
+ <entry>
+ 从 PHP 中移除。
+ </entry>
+ </row>
+ <row>
+ <entry>5.3.0</entry>
+ <entry>
+ Emits an <constant>E_DEPRECATED</constant> level error.
+ </entry>
+ </row>
+ <row>
+ <entry>5.0.0</entry>
+ <entry>
+ Deprecated, and generates an
<constant>E_COMPILE_WARNING</constant> level error.
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry xml:id="ini.expose-php">
+ <term>
+ <parameter>expose_php</parameter>
+ <type>boolean</type>
+ </term>
+ <listitem>
+ <para>
+ 决定是否暴露 PHP 被安装在服务器上(例如在 Web
+ 服务器的信息头中加上其签名:X-Powered-By: PHP/5.3.7)。 The PHP
logo
+ guids are also exposed, thus appending them to the URL of a PHP
enabled site
+ will display the appropriate logo
+ (e.g., <link
xlink:href="&url.php;?=PHPE9568F34-D428-11d2-A769-00AA001ACF42">&url.php;?=PHPE9568F34-D428-11d2-A769-00AA001ACF42</link>).
+ This also affects the output of <function>phpinfo</function>, as
when disabled, the PHP logo
+ and credits information will not be displayed.
+ </para>
+ <para>
+ See also <function>php_logo_guid</function> and
<function>phpcredits</function>.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry xml:id="ini.disable-functions">
+ <term>
+ <parameter>disable_functions</parameter>
+ <type>string</type>
+ </term>
+ <listitem>
+ <simpara>
+ 本指令允许你基于<link linkend="security">安全</link>原因禁止某些函
数。接受逗号分隔的函数名列表作为参数。
+ disable_functions 不受<link linkend="ini.safe-mode">安全模式
</link>的影响。
+ </simpara>
+ <simpara>
+ 本指令只能设置在 &php.ini; 中。例如不能将其设置在 &httpd.conf;。
+ </simpara>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry xml:id="ini.disable-classes">
+ <term>
+ <parameter>disable_classes</parameter>
+ <type>string</type>
+ </term>
+ <listitem>
+ <simpara>
+ 本指令可以使你出于<link
+ linkend="security">安全</link>的理由禁用某些类。用逗号分隔类名。
disable_classes
+ 不受<link linkend="ini.safe-mode">安全模式</link>的影响。
+ </simpara>
+ <simpara>
+ 本指令只能设置在 &php.ini; 中。例如不能将其设置在 &httpd.conf;。
+ </simpara>
+ <note>
+ <title>可用性说明</title>
+ <simpara>
+ 本指令自 PHP 4.3.2 起可用。
+ </simpara>
+ </note>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry xml:id="ini.zend.ze1-compatibility-mode">
+ <term>
+ <parameter>zend.ze1_compatibility_mode</parameter>
+ <type>boolean</type>
+ </term>
+ <listitem>
+ <para>
+ Enable compatibility mode with Zend Engine 1 (PHP 4). It affects
+ the cloning, casting (objects with no properties cast to &false;
or 0), and <link
+ linkend="language.oop5.object-comparison">comparing of
objects</link>.
+ In this mode, objects are passed by value instead of reference by
+ default.
+ </para>
+ <para>
+ See also the section titled
+ <link linkend="migration5">Migrating from PHP 4 to PHP 5</link>.
+ </para>
+ <warning>
+ <simpara>This feature has been <emphasis>DEPRECATED</emphasis> and
<emphasis>REMOVED</emphasis>
+ as of PHP 5.3.0.
+ </simpara>
+ </warning>
+
+ </listitem>
+ </varlistentry>
+
+ <varlistentry xml:id="ini.zend.multibyte">
+ <term>
+ <parameter>zend.multibyte</parameter>
+ <type>boolean</type>
+ </term>
+ <listitem>
+ <para>
+ Enables parsing of source files in multibyte encodings.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry xml:id="ini.zend.script-encoding">
+ <term>
+ <parameter>zend.script_encoding</parameter>
+ <type>string</type>
+ </term>
+ <listitem>
+ <para>
+ This value will be used unless a
+ <link
linkend="control-structures.declare.encoding">declare(encoding=...)</link>
+ directive appears at the top of the script.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry xml:id="ini.zend.signal-check">
+ <term>
+ <parameter>zend.signal_check</parameter>
+ <type>boolean</type>
+ </term>
+ <listitem>
+ <para>
+ To check for replaced signal handlers on shutdown.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry xml:id="ini.detect-unicode">
+ <term>
+ <parameter>detect_unicode</parameter>
+ <type>boolean</type>
+ </term>
+ <listitem>
+ <para>
+ Check for BOM (Byte Order Mark) and see if the file contains valid
+ multibyte characters.
+ This detection is performed before processing of
+ <function>__halt_compiler</function>.
+ Available only in Zend Multibyte mode.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry xml:id="ini.exit-on-timeout">
+ <term>
+ <parameter>exit_on_timeout</parameter>
+ <type>boolean</type>
+ </term>
+ <listitem>
+ <para>
+ This is an Apache1 mod_php-only directive that forces an Apache
child to exit if a PHP execution timeout occurred.
+ Such a timeout causes an internal longjmp() call in Apache1 which
can leave some extensions in an inconsistent
+ state. By terminating the process any outstanding locks or memory
will be cleaned up.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ </variablelist>
+ </para>
+ </section>
+
+ <section xml:id="ini.sect.resource-limits">
+ <title>Resource Limits</title>
+ <para>
+ <table>
+ <title>Resource Limits</title>
+ <tgroup cols="4">
+ <thead>
+ <row>
+ <entry>&Name;</entry>
+ <entry>&Default;</entry>
+ <entry>&Changeable;</entry>
+ <entry>&Changelog;</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry><link linkend="ini.memory-limit">memory_limit</link></entry>
+ <entry>"128M"</entry>
+ <entry>PHP_INI_ALL</entry>
+ <entry>"8M" before PHP 5.2.0, "16M" in PHP 5.2.0</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ </para>
+
+ &ini.descriptions.title;
+
+ <para>
+ <variablelist>
+ <varlistentry xml:id="ini.memory-limit">
+ <term>
+ <parameter>memory_limit</parameter>
+ <type>integer</type>
+ </term>
+ <listitem>
+ <para>
+ This sets the maximum amount of memory in bytes that a script
+ is allowed to allocate. This helps prevent poorly written
+ scripts for eating up all available memory on a server. Note that
+ to have no memory limit, set this directive to
<literal>-1</literal>.
+ </para>
+ <para>
+ Prior to PHP 5.2.1, in order to use this directive it had to
+ be enabled at compile time by using
+ <option role="configure">--enable-memory-limit</option> in the
+ configure line. This compile-time flag was also required to define
+ the functions <function>memory_get_usage</function> and
+ <function>memory_get_peak_usage</function> prior to 5.2.1.
+ </para>
+
+ &ini.shorthandbytes;
+
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </para>
+ <para>
+ See also: <link
linkend="ini.max-execution-time">max_execution_time</link>.
+ </para>
+ </section>
+
+ <section xml:id="ini.sect.performance">
+ <title>Performance Tuning</title>
+ <para>
+ <table>
+ <title>Performance Tuning</title>
+ <tgroup cols="4">
+ <thead>
+ <row>
+ <entry>&Name;</entry>
+ <entry>&Default;</entry>
+ <entry>&Changeable;</entry>
+ <entry>&Changelog;</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry><link
linkend="ini.realpath-cache-size">realpath_cache_size</link></entry>
+ <entry>"16K"</entry>
+ <entry>PHP_INI_SYSTEM</entry>
+ <entry>从 PHP 5.1.0 起可用。</entry>
+ </row>
+ <row>
+ <entry><link
linkend="ini.realpath-cache-ttl">realpath_cache_ttl</link></entry>
+ <entry>"120"</entry>
+ <entry>PHP_INI_SYSTEM</entry>
+ <entry>从 PHP 5.1.0 起可用。</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ </para>
+ &ini.descriptions.title;
+ <para>
+ <variablelist>
+ <varlistentry xml:id="ini.realpath-cache-size">
+ <term>
+ <parameter>realpath_cache_size</parameter>
+ <type>integer</type>
+ </term>
+ <listitem>
+ <para>
+ Determines the size of the realpath cache to be used by PHP. This
+ value should be increased on systems where PHP opens many files, to
+ reflect the quantity of the file operations performed.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry xml:id="ini.realpath-cache-ttl">
+ <term>
+ <parameter>realpath_cache_ttl</parameter>
+ <type>integer</type>
+ </term>
+ <listitem>
+ <para>
+ Duration of time (in seconds) for which to cache realpath
information
+ for a given file or directory. For systems with rarely changing
files,
+ consider increasing the value.
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </para>
+ </section>
+
+ <section xml:id="ini.sect.data-handling">
+ <title>Data Handling</title>
+ <para>
+ <table>
+ <title>Data Handling Configuration Options</title>
+ <tgroup cols="4">
+ <thead>
+ <row>
+ <entry>&Name;</entry>
+ <entry>&Default;</entry>
+ <entry>&Changeable;</entry>
+ <entry>&Changelog;</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry><link linkend="ini.track-vars">track_vars</link></entry>
+ <entry>"On"</entry>
+ <entry>PHP_INI_??</entry>
+ <entry></entry>
+ </row>
+ <row>
+ <entry><link
linkend="ini.arg-separator.output">arg_separator.output</link></entry>
+ <entry>"&amp;"</entry>
+ <entry>PHP_INI_ALL</entry>
+ <entry>从 PHP 4.0.5 起可用。</entry>
+ </row>
+ <row>
+ <entry><link
linkend="ini.arg-separator.input">arg_separator.input</link></entry>
+ <entry>"&amp;"</entry>
+ <entry>PHP_INI_PERDIR</entry>
+ <entry>从 PHP 4.0.5 起可用。</entry>
+ </row>
+ <row>
+ <entry><link
linkend="ini.variables-order">variables_order</link></entry>
+ <entry>"EGPCS"</entry>
+ <entry>PHP_INI_PERDIR</entry>
+ <entry>在 PHP &lt;= 5.0.5 时是 PHP_INI_ALL。</entry>
+ </row>
+ <row>
+ <entry><link
linkend="ini.request-order">request_order</link></entry>
+ <entry>""</entry>
+ <entry>PHP_INI_PERDIR</entry>
+ <entry>从 PHP 5.3.0 起可用</entry>
+ </row>
+ <row>
+ <entry><link
linkend="ini.auto-globals-jit">auto_globals_jit</link></entry>
+ <entry>"1"</entry>
+ <entry>PHP_INI_PERDIR</entry>
+ <entry>从 PHP 5.0.0 起可用。</entry>
+ </row>
+ <row>
+ <entry><link
linkend="ini.register-globals">register_globals</link></entry>
+ <entry>"0"</entry>
+ <entry>PHP_INI_PERDIR</entry>
+ <entry>在 PHP &lt;= 4.2.3 时是 PHP_INI_ALL。 在 PHP 5.4.0 中移除该
选项。</entry>
+ </row>
+ <row>
+ <entry><link
linkend="ini.register-argc-argv">register_argc_argv</link></entry>
+ <entry>"1"</entry>
+ <entry>PHP_INI_PERDIR</entry>
+ <entry>在 PHP &lt;= 4.2.3 时是 PHP_INI_ALL。</entry>
+ </row>
+ <row>
+ <entry><link
linkend="ini.register-long-arrays">register_long_arrays</link></entry>
+ <entry>"1"</entry>
+ <entry>PHP_INI_PERDIR</entry>
+ <entry>从 PHP 5.0.0. Deprecated in PHP 5.3.0. Removed in PHP 5.4.0
起可用。</entry>
+ </row>
+ <row>
+ <entry><link
linkend="ini.post-max-size">post_max_size</link></entry>
+ <entry>"8M"</entry>
+ <entry>PHP_INI_PERDIR</entry>
+ <entry>在 PHP &lt;= 4.2.3 时是 PHP_INI_SYSTEM。 从 PHP 4.0.3 起可
用。</entry>
+ </row>
+ <row>
+ <entry><link linkend="ini.gpc-order">gpc_order</link></entry>
+ <entry>"GPC"</entry>
+ <entry>PHP_INI_ALL</entry>
+ <entry></entry>
+ </row>
+ <row>
+ <entry><link
linkend="ini.auto-prepend-file">auto_prepend_file</link></entry>
+ <entry>NULL</entry>
+ <entry>PHP_INI_PERDIR</entry>
+ <entry>在 PHP &lt;= 4.2.3 时是 PHP_INI_ALL。</entry>
+ </row>
+ <row>
+ <entry><link
linkend="ini.auto-append-file">auto_append_file</link></entry>
+ <entry>NULL</entry>
+ <entry>PHP_INI_PERDIR</entry>
+ <entry>在 PHP &lt;= 4.2.3 时是 PHP_INI_ALL。</entry>
+ </row>
+ <row>
+ <entry><link
linkend="ini.default-mimetype">default_mimetype</link></entry>
+ <entry>"text/html"</entry>
+ <entry>PHP_INI_ALL</entry>
+ <entry></entry>
+ </row>
+ <row>
+ <entry><link
linkend="ini.default-charset">default_charset</link></entry>
+ <entry>""</entry>
+ <entry>PHP_INI_ALL</entry>
+ <entry></entry>
+ </row>
+ <row>
+ <entry><link
linkend="ini.always-populate-raw-post-data">always_populate_raw_post_data</link></entry>
+ <entry>"0"</entry>
+ <entry>PHP_INI_PERDIR</entry>
+ <entry>在 PHP &lt;= 4.2.3 时是 PHP_INI_ALL。 从 PHP 4.1.0 起可用。
</entry>
+ </row>
+ <row>
+ <entry><link
linkend="ini.allow-webdav-methods">allow_webdav_methods</link></entry>
+ <entry>"0"</entry>
+ <entry>PHP_INI_PERDIR</entry>
+ <entry></entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ </para>
+
+ &ini.descriptions.title;
+
+ <para>
+ <variablelist>
+ <varlistentry xml:id="ini.track-vars">
+ <term>
+ <parameter>track_vars</parameter>
+ <type>boolean</type>
+ </term>
+ <listitem>
+ <para>
+ If enabled, then Environment, GET, POST, Cookie, and Server
+ variables can be found in the global associative arrays
+ <varname>$_ENV</varname>,
+ <varname>$_GET</varname>,
+ <varname>$_POST</varname>,
+ <varname>$_COOKIE</varname>, and
+ <varname>$_SERVER</varname>.
+ </para>
+ <para>
+ Note that as of PHP 4.0.3, <systemitem
+ role="directive">track_vars</systemitem> is always turned on.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry xml:id="ini.arg-separator.output">
+ <term>
+ <parameter>arg_separator.output</parameter>
+ <type>string</type>
+ </term>
+ <listitem>
+ <para>
+ The separator used in PHP generated URLs to separate arguments.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry xml:id="ini.arg-separator.input">
+ <term>
+ <parameter>arg_separator.input</parameter>
+ <type>string</type>
+ </term>
+ <listitem>
+ <para>
+ List of separator(s) used by PHP to parse input URLs into
variables.
+ </para>
+ <note>
+ <para>
+ Every character in this directive is considered as separator!
+ </para>
+ </note>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry xml:id="ini.variables-order">
+ <term>
+ <parameter>variables_order</parameter>
+ <type>string</type>
+ </term>
+ <listitem>
+ <para>
+ Sets the order of the EGPCS (<literal>E</literal>nvironment,
+ <literal>G</literal>et, <literal>P</literal>ost,
+ <literal>C</literal>ookie, and <literal>S</literal>erver) variable
+ parsing. For example, if variables_order
+ is set to <literal>"SP"</literal> then PHP will create the
+ &link.superglobals; <varname>$_SERVER</varname> and
+ <varname>$_POST</varname>, but not create
+ <varname>$_ENV</varname>, <varname>$_GET</varname>, and
+ <varname>$_COOKIE</varname>. Setting to "" means no
+ &link.superglobals; will be set.
+ </para>
+ <para>
+ If the deprecated
+ <link linkend="ini.register-globals">register_globals</link>
+ directive is on, then variables_order also
+ configures the order the <literal>ENV</literal>,
+ <literal>GET</literal>, <literal>POST</literal>,
+ <literal>COOKIE</literal> and <literal>SERVER</literal> variables
+ are populated in global scope. So for example if variables_order
+ is set to <literal>"EGPCS"</literal>, register_globals is enabled,
+ and both <varname>$_GET['action']</varname> and
+ <varname>$_POST['action']</varname> are set, then
+ <varname>$action</varname> will contain the value of
+ <varname>$_POST['action']</varname> as <literal>P</literal> comes
+ after <literal>G</literal> in our example directive value.
+ </para>
+ <warning>
+ <para>
+ In both the CGI and FastCGI SAPIs,
+ <varname>$_SERVER</varname> is
+ also populated by values from the environment;
<literal>S</literal>
+ is always equivalent to <literal>ES</literal> regardless of the
+ placement of <literal>E</literal> elsewhere in this directive.
+ </para>
+ </warning>
+ <note>
+ <para>
+ The content and order of
+ <varname>$_REQUEST</varname> is also
+ affected by this directive.
+ </para>
+ </note>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry xml:id="ini.request-order">
+ <term>
+ <parameter>request_order</parameter>
+ <type>string</type>
+ </term>
+ <listitem>
+ <para>
+ This directive describes the order in which PHP registers GET, POST
+ and Cookie variables into the _REQUEST array. Registration is done
+ from left to right, newer values override older values.
+ </para>
+ <para>
+ If this directive is not set, <link
+ linkend="ini.variables-order">variables_order</link> is used for
+ <varname>$_REQUEST</varname> contents.
+ </para>
+ <para>
+ Note that the default distribution <filename>php.ini</filename>
files does not contain
+ the <literal>'C'</literal> for cookies, due to security concerns.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry xml:id="ini.auto-globals-jit">
+ <term>
+ <parameter>auto_globals_jit</parameter>
+ <type>boolean</type>
+ </term>
+ <listitem>
+ <para>
+ When enabled, the SERVER and ENV variables are created when they're
+ first used (Just In Time) instead of when the script starts. If
these
+ variables are not used within a script, having this directive on
will
+ result in a performance gain.
+ </para>
+ <para>
+ The PHP directives
+ <link linkend="ini.register-globals">register_globals</link>,
+ <link
linkend="ini.register-long-arrays">register_long_arrays</link>,
+ and <link
linkend="ini.register-argc-argv">register_argc_argv</link>
+ must be disabled for this directive to have any affect. Since PHP
+ 5.1.3 it is not necessary to have <link
+ linkend="ini.register-argc-argv">register_argc_argv</link>
disabled.
+ </para>
+ <warning>
+ <para>
+ Usage of SERVER and ENV variables is checked during the compile
time
+ so using them through e.g. <link
+ linkend="language.variables.variable">variable variables</link>
will
+ not cause their initialization.
+ </para>
+ </warning>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry xml:id="ini.register-globals">
+ <term>
+ <parameter>register_globals</parameter>
+ <type>boolean</type>
+ </term>
+ <listitem>
+ <para>
+ Whether or not to register the EGPCS (Environment, GET,
+ POST, Cookie, Server) variables as global variables.
+ </para>
+ <para>
+ As of <link xlink:href="&url.php.release4.2.0;">PHP 4.2.0</link>,
+ this directive defaults to <emphasis>off</emphasis>.
+ </para>
+ <para>
+ Please read the security chapter on
+ <link linkend="security.globals">Using register_globals</link>
+ for related information.
+ </para>
+ <para>
+ Please note that <systemitem
role="directive">register_globals</systemitem>
+ cannot be set at runtime (<function>ini_set</function>). Although,
you can
+ use &htaccess; if your host allows it as described
+ above. An example &htaccess; entry:
+ <userinput>php_flag register_globals off</userinput>.
+ </para>
+ <note>
+ <para>
+ <systemitem role="directive">register_globals</systemitem> is
affected
+ by the <link linkend="ini.variables-order">variables_order</link>
+ directive.
+ </para>
+ </note>
+ &warn.deprecated.feature-5-3-0.removed-5-4-0;
+ </listitem>
+ </varlistentry>
+
+ <varlistentry xml:id="ini.register-argc-argv">
+ <term>
+ <parameter>register_argc_argv</parameter>
+ <type>boolean</type>
+ </term>
+ <listitem>
+ <simpara>
+ Tells PHP whether to declare the argv &amp; argc variables
+ (that would contain the GET information).
+ </simpara>
+ <simpara>
+ See also <link linkend="features.commandline">command line</link>.
+ </simpara>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry xml:id="ini.register-long-arrays">
+ <term>
+ <parameter>register_long_arrays</parameter>
+ <type>boolean</type>
+ </term>
+ <listitem>
+ <simpara>
+ Tells PHP whether or not to register the deprecated long
+ <varname>$HTTP_*_VARS</varname> type
+ <link linkend="language.variables.predefined">predefined
+ variables</link>. When On (default), long predefined PHP
+ variables like <varname>$HTTP_GET_VARS</varname> will be defined.
+ If you're not using them, it's recommended to turn them off,
+ for performance reasons. Instead, use the superglobal arrays,
+ like <varname>$_GET</varname>.
+ </simpara>
+ <simpara>
+ This directive became available in PHP 5.0.0.
+ </simpara>
+ &warn.deprecated.feature-5-3-0.removed-5-4-0;
+ </listitem>
+ </varlistentry>
+
+ <varlistentry xml:id="ini.enable-post-data-reading">
+ <term>
+ <parameter>enable_post_data_reading</parameter>
+ <type>boolean</type>
+ </term>
+ <listitem>
+ <simpara>
+ Disabling this option causes <varname>$_POST</varname> and
+ <varname>$_FILES</varname> <emphasis>not</emphasis> to be
populated.
+ The only way to read postdata will then be through the
+ <link linkend="wrappers.php">php://input</link> stream wrapper.
+ This can be useful to proxy requests or to process
+ the POST data in a memory efficient fashion.
+ </simpara>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry xml:id="ini.post-max-size">
+ <term>
+ <parameter>post_max_size</parameter>
+ <type>integer</type>
+ </term>
+ <listitem>
+ <simpara>
+ Sets max size of post data allowed. This setting also affects
+ file upload. To upload large files, this value must be larger
+ than <link
linkend="ini.upload-max-filesize">upload_max_filesize</link>.
+ </simpara>
+ <simpara>
+ If memory limit is enabled by your configure script, <link
+ linkend="ini.memory-limit">memory_limit</link> also affects
+ file uploading. Generally speaking,
+ <link linkend="ini.memory-limit">memory_limit</link> should be
+ larger than <parameter>post_max_size</parameter>.
+ </simpara>
+
+ &ini.shorthandbytes;
+
+ <simpara>
+ If the size of post data is greater than post_max_size, the
+ <varname>$_POST</varname> and <varname>$_FILES</varname>
+ <link linkend="language.variables.superglobals">superglobals</link>
+ are empty. This can be tracked in various ways, e.g. by passing the
+ <varname>$_GET</varname> variable to the script processing the
data,
+ i.e. <literal>&lt;form action="edit.php?processed=1"&gt;</literal>,
+ and then checking if <varname>$_GET['processed']</varname> is set.
+ </simpara>
+ <para>
+ <note>
+ <para>
+ PHP allows shortcuts for bit values, including K (kilo), M (mega)
+ and G (giga). PHP will do the conversions automatically if you
+ use any of these. Be careful not to exceed the 32 bit signed
integer
+ limit (if you're using 32bit versions) as it will cause your
script
+ to fail.
+ </para>
+ </note>
+ </para>
+
+ </listitem>
+ </varlistentry>
+
+ <varlistentry xml:id="ini.gpc-order">
+ <term>
***The diff for this file has been truncated for email.***
=======================================
--- /dev/null
+++ /trunk/xml/appendices/ini.list.xml Mon Apr 9 09:11:24 2012
@@ -0,0 +1,3661 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- $Revision: 324974 $ -->
+<!-- EN-Revision: 324591 Maintainer: HonestQiao Status: ready -->
+<!-- Reviewed: no Maintainer: HonestQiao -->
+<section xml:id="ini.list" xmlns="http://docbook.org/ns/docbook"
xmlns:xlink="http://www.w3.org/1999/xlink">
+ <title>&php.ini; 配置选项列表</title>
+ <para>
+ 可以在 &php.ini; 中使用下列配置选项对 PHP 进行配置。
+ </para>
+ <para>
+ "可修改范围"列决定了该配置选项在什么情况下可以被设置。
+ 查看 <link linkend="configuration.changes.modes">可变配置选项</link> 列
表查看具体定义。
+ </para>
+ <para>
+ <table>
+ <title>配置选项</title>
+ <tgroup cols="4">
+ <thead>
+ <row>
+ <entry>&Name;</entry>
+ <entry>&Default;</entry>
+ <entry>&Changeable;</entry>
+ <entry>&Changelog;</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry><link
linkend="ini.allow-call-time-pass-reference">allow_call_time_pass_reference</link></entry>
+ <entry>"1"</entry>
+ <entry>PHP_INI_PERDIR</entry>
+ <entry>在 PHP 4.0.0 时是 PHP_INI_ALL。 在 PHP 5.4.0 中移除该选项。
</entry>
+ </row>
+ <row>
+ <entry><link
linkend="ini.allow-url-fopen">allow_url_fopen</link></entry>
+ <entry>"1"</entry>
+ <entry>PHP_INI_SYSTEM</entry>
+ <entry>在 PHP &lt;= 4.3.4 时是 PHP_INI_ALL。</entry>
+ <!-- FIXME PHP_6
+ <entry>PHP_INI_ALL</entry>
+ <entry>在 PHP &lt;= 4.3.4 时是 PHP_INI_ALL。 在 PHP &lt; 6 时是
PHP_INI_SYSTEM。</entry>
+ -->
+ </row>
+ <row>
+ <entry><link
linkend="ini.allow-url-include">allow_url_include</link></entry>
+ <entry>"0"</entry>
+ <entry>PHP_INI_ALL</entry>
+ <entry>在 PHP 5 时是 PHP_INI_SYSTEM。 从 PHP 5.2.0 起可用。</entry>
+ </row>
+ <row>
+ <entry><link
linkend="ini.always-populate-raw-post-data">always_populate_raw_post_data</link></entry>
+ <entry>"0"</entry>
+ <entry>PHP_INI_PERDIR</entry>
+ <entry>在 PHP &lt;= 4.2.3 时是 PHP_INI_ALL。 从 PHP 4.1.0 起可用。
</entry>
+ </row>
+ <row>
+ <entry><link
linkend="ini.apc.cache-by-default">apc.cache_by_default</link></entry>
+ <entry>"1"</entry>
+ <entry>PHP_INI_ALL</entry>
+ <entry>在 APC &lt;= 3.0.12 时是 PHP_INI_SYSTEM。 从 APC 3.0.0 起可
用。</entry>
+ </row>
+ <row>
+ <entry><link linkend="ini.apc.enabled">apc.enabled</link></entry>
+ <entry>"1"</entry>
+ <entry>PHP_INI_SYSTEM</entry>
+ <entry>在 APC 2 时是 PHP_INI_SYSTEM。 在 APC &lt;= 3.0.12 时是
PHP_INI_ALL。</entry>
+ </row>
+ <row>
+ <entry><link
linkend="ini.apc.enable-cli">apc.enable_cli</link></entry>
+ <entry>"0"</entry>
+ <entry>PHP_INI_SYSTEM</entry>
+ <entry>从 APC 3.0.7 起可用。</entry>
+ </row>
+ <row>
+ <entry><link
linkend="ini.apc.file-update-protection">apc.file_update_protection</link></entry>
+ <entry>"2"</entry>
+ <entry>PHP_INI_SYSTEM</entry>
+ <entry>从 APC 3.0.6 起可用。</entry>
+ </row>
+ <row>
+ <entry><link linkend="ini.apc.filters">apc.filters</link></entry>
+ <entry>NULL</entry>
+ <entry>PHP_INI_SYSTEM</entry>
+ <entry></entry>
+ </row>
+ <row>
+ <entry><link linkend="ini.apc.gc-ttl">apc.gc_ttl</link></entry>
+ <entry>"3600"</entry>
+ <entry>PHP_INI_SYSTEM</entry>
+ <entry></entry>
+ </row>
+ <row>
+ <entry><link
linkend="ini.apc.include-once-override">apc.include_once_override</link></entry>
+ <entry>"0"</entry>
+ <entry>PHP_INI_SYSTEM</entry>
+ <entry>从 APC 3.0.12 起可用。</entry>
+ </row>
+ <row>
+ <entry><link
linkend="ini.apc.localcache">apc.localcache</link></entry>
+ <entry>"0"</entry>
+ <entry>PHP_INI_SYSTEM</entry>
+ <entry>从 APC 3.0.14 起可用。</entry>
+ </row>
+ <row>
+ <entry><link
linkend="ini.apc.localcache.size">apc.localcache.size</link></entry>
+ <entry>"512"</entry>
+ <entry>PHP_INI_SYSTEM</entry>
+ <entry>从 APC 3.0.14 起可用。</entry>
+ </row>
+ <row>
+ <entry><link
linkend="ini.apc.max-file-size">apc.max_file_size</link></entry>
+ <entry>"1M"</entry>
+ <entry>PHP_INI_SYSTEM</entry>
+ <entry>从 APC 3.0.7 起可用。</entry>
+ </row>
+ <row>
+ <entry><link
linkend="ini.apc.mmap-file-mask">apc.mmap_file_mask</link></entry>
+ <entry>NULL</entry>
+ <entry>PHP_INI_SYSTEM</entry>
+ <entry></entry>
+ </row>
+ <row>
+ <entry><link
linkend="ini.apc.num-files-hint">apc.num_files_hint</link></entry>
+ <entry>"1000"</entry>
+ <entry>PHP_INI_SYSTEM</entry>
+ <entry></entry>
+ </row>
+ <row>
+ <entry><link
linkend="ini.apc.optimization">apc.optimization</link></entry>
+ <entry>"0"</entry>
+ <entry>PHP_INI_ALL</entry>
+ <entry>在 APC 2 时是 PHP_INI_SYSTEM。 在 APC 3.0.13 中移除该选项。
</entry>
+ </row>
+ <row>
+ <entry><link
linkend="ini.apc.report-autofilter">apc.report_autofilter</link></entry>
+ <entry>"0"</entry>
+ <entry>PHP_INI_SYSTEM</entry>
+ <entry>从 APC 3.0.11 起可用。</entry>
+ </row>
+ <row>
+ <entry><link linkend="ini.apc.rfc1867">apc.rfc1867</link></entry>
+ <entry>"0"</entry>
+ <entry>PHP_INI_SYSTEM</entry>
+ <entry>从 APC 3.0.13 起可用。</entry>
+ </row>
+ <row>
+ <entry><link
linkend="ini.apc.rfc1867-freq">apc.rfc1867_freq</link></entry>
+ <entry>"0"</entry>
+ <entry>PHP_INI_SYSTEM</entry>
+ <entry></entry>
+ </row>
+ <row>
+ <entry><link
linkend="ini.apc.rfc1867-name">apc.rfc1867_name</link></entry>
+ <entry>"APC_UPLOAD_PROGRESS"</entry>
+ <entry>PHP_INI_SYSTEM</entry>
+ <entry></entry>
+ </row>
+ <row>
+ <entry><link
linkend="ini.apc.rfc1867-prefix">apc.rfc1867_prefix</link></entry>
+ <entry>"upload_"</entry>
+ <entry>PHP_INI_SYSTEM</entry>
+ <entry></entry>
+ </row>
+ <row>
+ <entry><link
linkend="ini.apc.shm-segments">apc.shm_segments</link></entry>
+ <entry>"1"</entry>
+ <entry>PHP_INI_SYSTEM</entry>
+ <entry></entry>
+ </row>
+ <row>
+ <entry><link linkend="ini.apc.shm-size">apc.shm_size</link></entry>
+ <entry>"30"</entry>
+ <entry>PHP_INI_SYSTEM</entry>
+ <entry></entry>
+ </row>
+ <row>
+ <entry><link
linkend="ini.apc.slam-defense">apc.slam_defense</link></entry>
+ <entry>"0"</entry>
+ <entry>PHP_INI_SYSTEM</entry>
+ <entry>从 APC 3.0.0 起可用。</entry>
+ </row>
+ <row>
+ <entry><link linkend="ini.apc.stat">apc.stat</link></entry>
+ <entry>"1"</entry>
+ <entry>PHP_INI_SYSTEM</entry>
+ <entry>从 APC 3.0.10 起可用。</entry>
+ </row>
+ <row>
+ <entry><link
linkend="ini.apc.stat-ctime">apc.stat_ctime</link></entry>
+ <entry>"0"</entry>
+ <entry>PHP_INI_SYSTEM</entry>
+ <entry>从 APC 3.0.13 起可用。</entry>
+ </row>
+ <row>
+ <entry><link linkend="ini.apc.ttl">apc.ttl</link></entry>
+ <entry>"0"</entry>
+ <entry>PHP_INI_SYSTEM</entry>
+ <entry>从 APC 3.0.0 起可用。</entry>
+ </row>
+ <row>
+ <entry><link
linkend="ini.apc.user-entries-hint">apc.user_entries_hint</link></entry>
+ <entry>"4096"</entry>
+ <entry>PHP_INI_SYSTEM</entry>
+ <entry>从 APC 3.0.0 起可用。</entry>
+ </row>
+ <row>
+ <entry><link linkend="ini.apc.user-ttl">apc.user_ttl</link></entry>
+ <entry>"0"</entry>
+ <entry>PHP_INI_SYSTEM</entry>
+ <entry>从 APC 3.0.0 起可用。</entry>
+ </row>
+ <row>
+ <entry><link
linkend="ini.apc.write-lock">apc.write_lock</link></entry>
+ <entry>"1"</entry>
+ <entry>PHP_INI_SYSTEM</entry>
+ <entry>从 APC 3.0.11 起可用。</entry>
+ </row>
+ <row>
+ <entry>apd.bitmask</entry>
+ <entry>"0"</entry>
+ <entry>PHP_INI_ALL</entry>
+ <entry>在 apd 0.9 中移除该选项。</entry>
+ </row>
+ <row>
+ <entry><link linkend="ini.apd.dumpdir">apd.dumpdir</link></entry>
+ <entry>NULL</entry>
+ <entry>PHP_INI_ALL</entry>
+ <entry></entry>
+ </row>
+ <row>
+ <entry><link
linkend="ini.apd.statement-tracing">apd.statement_tracing</link></entry>
+ <entry>"0"</entry>
+ <entry>PHP_INI_ALL</entry>
+ <entry>从 apd 0.9 起可用。</entry>
+ </row>
+ <row>
+ <entry>arg_separator</entry>
+ <entry>"&amp;"</entry>
+ <entry>PHP_INI_ALL</entry>
+ <entry>在 PHP 4.0.6 中移除该选项。</entry>
+ </row>
+ <row>
+ <entry><link
linkend="ini.arg-separator.input">arg_separator.input</link></entry>
+ <entry>"&amp;"</entry>
+ <entry>PHP_INI_PERDIR</entry>
+ <entry>从 PHP 4.0.5 起可用。</entry>
+ </row>
+ <row>
+ <entry><link
linkend="ini.arg-separator.output">arg_separator.output</link></entry>
+ <entry>"&amp;"</entry>
+ <entry>PHP_INI_ALL</entry>
+ <entry>从 PHP 4.0.5 起可用。</entry>
+ </row>
+ <row>
+ <entry><link linkend="ini.asp-tags">asp_tags</link></entry>
+ <entry>"0"</entry>
+ <entry>PHP_INI_PERDIR</entry>
+ <entry>在 PHP 4.0.0 时是 PHP_INI_ALL。</entry>
+ </row>
+ <row>
+ <entry><link
linkend="ini.assert.active">assert.active</link></entry>
+ <entry>"1"</entry>
+ <entry>PHP_INI_ALL</entry>
+ <entry></entry>
+ </row>
+ <row>
+ <entry><link linkend="ini.assert.bail">assert.bail</link></entry>
+ <entry>"0"</entry>
+ <entry>PHP_INI_ALL</entry>
+ <entry></entry>
+ </row>
+ <row>
+ <entry><link
linkend="ini.assert.callback">assert.callback</link></entry>
+ <entry>NULL</entry>
+ <entry>PHP_INI_ALL</entry>
+ <entry></entry>
+ </row>
+ <row>
+ <entry><link
linkend="ini.assert.quiet-eval">assert.quiet_eval</link></entry>
+ <entry>"0"</entry>
+ <entry>PHP_INI_ALL</entry>
+ <entry></entry>
+ </row>
+ <row>
+ <entry><link
linkend="ini.assert.warning">assert.warning</link></entry>
+ <entry>"1"</entry>
+ <entry>PHP_INI_ALL</entry>
+ <entry></entry>
+ </row>
+ <row>
+ <entry>async_send</entry>
+ <entry>"0"</entry>
+ <entry>PHP_INI_ALL</entry>
+ <entry>从 PHP 4.2.0 起可用。 在 PHP 4.3.0 中移除该选项。</entry>
+ </row>
+ <row>
+ <entry><link
linkend="ini.auto-append-file">auto_append_file</link></entry>
+ <entry>NULL</entry>
+ <entry>PHP_INI_PERDIR</entry>
+ <entry>在 PHP &lt;= 4.2.3 时是 PHP_INI_ALL。</entry>
+ </row>
+ <row>
+ <entry><link
linkend="ini.auto-detect-line-endings">auto_detect_line_endings</link></entry>
+ <entry>"0"</entry>
+ <entry>PHP_INI_ALL</entry>
+ <entry>从 PHP 4.3.0 起可用。</entry>
+ </row>
+ <row>
+ <entry><link
linkend="ini.auto-globals-jit">auto_globals_jit</link></entry>
+ <entry>"1"</entry>
+ <entry>PHP_INI_PERDIR</entry>
+ <entry>从 PHP 5.0.0 起可用。</entry>
+ </row>
+ <row>
+ <entry><link
linkend="ini.auto-prepend-file">auto_prepend_file</link></entry>
+ <entry>NULL</entry>
+ <entry>PHP_INI_PERDIR</entry>
+ <entry>在 PHP &lt;= 4.2.3 时是 PHP_INI_ALL。</entry>
+ </row>
+ <row>
+ <entry>axis2.client_home</entry>
+ <entry>"~/work/axisc/c/deply"</entry>
+ <entry>PHP_INI_ALL</entry>
+ <entry></entry>
+ </row>
+ <row>
+ <entry>axis2.enable_exception</entry>
+ <entry>"1"</entry>
+ <entry>PHP_INI_ALL</entry>
+ <entry></entry>
+ </row>
+ <row>
+ <entry>axis2.enable_trace</entry>
+ <entry>"1"</entry>
+ <entry>PHP_INI_ALL</entry>
+ <entry></entry>
+ </row>
+ <row>
+ <entry>axis2.log_path</entry>
+ <entry>"/tmp"</entry>
+ <entry>PHP_INI_ALL</entry>
+ <entry></entry>
+ </row>
+ <row>
+ <entry><link linkend="ini.bcmath.scale">bcmath.scale</link></entry>
+ <entry>"0"</entry>
+ <entry>PHP_INI_ALL</entry>
+ <entry></entry>
+ </row>
+ <row>
+ <entry>bcompiler.enabled</entry>
+ <entry>"1"</entry>
+ <entry>PHP_INI_ALL</entry>
+ <entry>从 bcompiler 0.8 起可用。</entry>
+ </row>
+ <row>
+ <entry>birdstep.max_links</entry>
+ <entry>"-1"</entry>
+ <entry>PHP_INI_ALL</entry>
+ <entry>从 PHP 4.2.0 起可用。</entry>
+ </row>
+ <row>
+ <entry>blenc.key_file</entry>
+ <entry>"/usr/local/etc/blenckeys"</entry>
+ <entry>PHP_INI_ALL</entry>
+ <entry></entry>
+ </row>
+ <row>
+ <entry><link linkend="ini.browscap">browscap</link></entry>
+ <entry>NULL</entry>
+ <entry>PHP_INI_SYSTEM</entry>
+ <entry></entry>
+ </row>
+ <row>
+ <entry><link
linkend="ini.cgi.check-shebang-line">cgi.check_shebang_line</link></entry>
+ <entry>"1"</entry>
+ <entry>PHP_INI_SYSTEM</entry>
+ <entry>从 PHP 5.2.1 起可用。</entry>
+ </row>
+ <row>
+ <entry>cgi.discard_path</entry>
+ <entry>"0"</entry>
+ <entry>PHP_INI_SYSTEM</entry>
+ <entry>从 PHP 5.3.0 起可用。</entry>
+ </row>
+ <row>
+ <entry><link
linkend="ini.cgi.fix-pathinfo">cgi.fix_pathinfo</link></entry>
+ <entry>"1"</entry>
+ <entry>PHP_INI_SYSTEM</entry>
+ <entry>在 PHP &lt;= 5.2.0 时是 PHP_INI_ALL。 从 PHP 4.3.0 起可用。
</entry>
+ </row>
+ <row>
+ <entry><link
linkend="ini.cgi.force-redirect">cgi.force_redirect</link></entry>
+ <entry>"1"</entry>
+ <entry>PHP_INI_SYSTEM</entry>
+ <entry>在 PHP &lt;= 5.2.0 时是 PHP_INI_ALL。 从 PHP 4.2.0 起可用。
</entry>
+ </row>
+ <row>
+ <entry>cgi.nph</entry>
+ <entry>"0"</entry>
+ <entry>PHP_INI_ALL</entry>
+ <entry>从 PHP 4.3.5 起可用。</entry>
+ </row>
+ <row>
+ <entry><link
linkend="ini.cgi.redirect-status-env">cgi.redirect_status_env</link></entry>
+ <entry>NULL</entry>
+ <entry>PHP_INI_SYSTEM</entry>
+ <entry>在 PHP &lt;= 5.2.0 时是 PHP_INI_ALL。 从 PHP 4.2.0 起可用。
</entry>
+ </row>
+ <row>
+ <entry><link
linkend="ini.cgi.rfc2616-headers">cgi.rfc2616_headers</link></entry>
+ <entry>"0"</entry>
+ <entry>PHP_INI_ALL</entry>
+ <entry>从 PHP 4.3.0 起可用。</entry>
+ </row>
+ <row>
+ <entry><link
linkend="ini.child-terminate">child_terminate</link></entry>
+ <entry>"0"</entry>
+ <entry>PHP_INI_ALL</entry>
+ <entry>从 PHP 4.0.5 起可用。</entry>
+ </row>
+ <row>
+ <entry><link linkend="ini.cli.pager">cli.pager</link></entry>
+ <entry>""</entry>
+ <entry>PHP_INI_ALL</entry>
+ <entry>从 PHP 5.4.0 起可用。</entry>
+ </row>
+ <row>
+ <entry><link linkend="ini.cli.prompt">cli.prompt</link></entry>
+ <entry>"\\b \\> "</entry>
+ <entry>PHP_INI_ALL</entry>
+ <entry>从 PHP 5.4.0 起可用。</entry>
+ </row>
+ <row>
+ <entry><link
linkend="ini.cli-server.color">cli_server.color</link></entry>
+ <entry>"0"</entry>
+ <entry>PHP_INI_ALL</entry>
+ <entry>从 PHP 5.4.0 起可用。</entry>
+ </row>
+ <row>
+ <entry>coin_acceptor.autoreset</entry>
+ <entry>"On"</entry>
+ <entry>PHP_INI_ALL</entry>
+ <entry>在 coin_acceptor 0.2 中移除该选项。</entry>
+ </row>
+ <row>
+ <entry>coin_acceptor.auto_initialize</entry>
+ <entry>"Off"</entry>
+ <entry>PHP_INI_ALL</entry>
+ <entry>从 coin_acceptor 0.2 起可用。</entry>
+ </row>
+ <row>
+ <entry>coin_acceptor.auto_reset</entry>
+ <entry>"On"</entry>
+ <entry>PHP_INI_ALL</entry>
+ <entry>从 coin_acceptor 0.2 起可用。</entry>
+ </row>
+ <row>
+ <entry>coin_acceptor.command_function</entry>
+ <entry>"Off"</entry>
+ <entry>PHP_INI_ALL</entry>
+ <entry>从 coin_acceptor 0.3 起可用。</entry>
+ </row>
+ <row>
+ <entry>coin_acceptor.delay</entry>
+ <entry>"53132"</entry>
+ <entry>PHP_INI_ALL</entry>
+ <entry>在 coin_acceptor 0.2 中移除该选项。</entry>
+ </row>
+ <row>
+ <entry>coin_acceptor.delay_coins</entry>
+ <entry>"53132"</entry>
+ <entry>PHP_INI_ALL</entry>
+ <entry>从 coin_acceptor 0.2 起可用。</entry>
+ </row>
+ <row>
+ <entry>coin_acceptor.delay_prom</entry>
+ <entry>"55748"</entry>
+ <entry>PHP_INI_ALL</entry>
+ <entry>从 coin_acceptor 0.2 起可用。</entry>
+ </row>
+ <row>
+ <entry>coin_acceptor.device</entry>
+ <entry>"/dev/ttyS1"</entry>
+ <entry>PHP_INI_ALL</entry>
+ <entry>在 coin_acceptor 0.2 中移除该选项。</entry>
+ </row>
+ <row>
+ <entry>coin_acceptor.lock_on_close</entry>
+ <entry>"Off"</entry>
+ <entry>PHP_INI_ALL</entry>
+ <entry>从 coin_acceptor 0.2 起可用。</entry>
+ </row>
+ <row>
+ <entry>coin_acceptor.start_unlocked</entry>
+ <entry>"On"</entry>
+ <entry>PHP_INI_ALL</entry>
+ <entry>从 coin_acceptor 0.2 起可用。</entry>
+ </row>
+ <row>
+ <entry><link
linkend="ini.com.allow-dcom">com.allow_dcom</link></entry>
+ <entry>"0"</entry>
+ <entry>PHP_INI_SYSTEM</entry>
+ <entry>从 PHP 4.0.5 起可用。</entry>
+ </row>
+ <row>
+ <entry><link
linkend="ini.com.autoregister-casesensitive">com.autoregister_casesensitive</link></entry>
+ <entry>"1"</entry>
+ <entry>PHP_INI_ALL</entry>
+ <entry>在 PHP 4 时是 PHP_INI_SYSTEM。从 PHP 4.1.0 起可用。</entry>
+ </row>
+ <row>
+ <entry><link
linkend="ini.com.autoregister-typelib">com.autoregister_typelib</link></entry>
+ <entry>"0"</entry>
+ <entry>PHP_INI_ALL</entry>
+ <entry>在 PHP 4 时是 PHP_INI_SYSTEM。 从 PHP 4.1.0 起可用。</entry>
+ </row>
+ <row>
+ <entry><link
linkend="ini.com.autoregister-verbose">com.autoregister_verbose</link></entry>
+ <entry>"0"</entry>
+ <entry>PHP_INI_ALL</entry>
+ <entry>在 PHP 4 时是 PHP_INI_SYSTEM。 从 PHP 4.1.0 起可用。</entry>
+ </row>
+ <row>
+ <entry><link
linkend="ini.com.code-page">com.code_page</link></entry>
+ <entry>""</entry>
+ <entry>PHP_INI_ALL</entry>
+ <entry>从 PHP 5.0.0 起可用。</entry>
+ </row>
+ <row>
+ <entry><link
linkend="ini.com.typelib-file">com.typelib_file</link></entry>
+ <entry>""</entry>
+ <entry>PHP_INI_SYSTEM</entry>
+ <entry>从 PHP 4.0.5 起可用。</entry>
+ </row>
+ <row>
+ <entry>crack.default_dictionary</entry>
+ <entry>NULL</entry>
+ <entry>PHP_INI_PERDIR</entry>
+ <entry>在 crack &lt;= 0.2 时是 PHP_INI_SYSTEM。 从 PHP 4.0.5 起可
用。 在 PHP 5.0.0 中移除该选项。</entry>
+ </row>
+ <row>
+ <entry>daffodildb.default_host</entry>
+ <entry>"localhost"</entry>
+ <entry>PHP_INI_ALL</entry>
+ <entry></entry>
+ </row>
+ <row>
+ <entry>daffodildb.default_password</entry>
+ <entry>"daffodil"</entry>
+ <entry>PHP_INI_ALL</entry>
+ <entry></entry>
+ </row>
+ <row>
+ <entry>daffodildb.default_socket</entry>
+ <entry>NULL</entry>
+ <entry>PHP_INI_ALL</entry>
+ <entry></entry>
+ </row>
+ <row>
+ <entry>daffodildb.default_user</entry>
+ <entry>"DAFFODIL"</entry>
+ <entry>PHP_INI_ALL</entry>
+ <entry></entry>
+ </row>
+ <row>
+ <entry>daffodildb.port</entry>
+ <entry>"3456"</entry>
+ <entry>PHP_INI_ALL</entry>
+ <entry></entry>
+ </row>
+ <row>
+ <entry><link
linkend="ini.date.default-latitude">date.default_latitude</link></entry>
+ <entry>"31.7667"</entry>
+ <entry>PHP_INI_ALL</entry>
+ <entry>从 PHP 5.0.0 起可用。</entry>
+ </row>
+ <row>
+ <entry><link
linkend="ini.date.default-longitude">date.default_longitude</link></entry>
+ <entry>"35.2333"</entry>
+ <entry>PHP_INI_ALL</entry>
+ <entry>从 PHP 5.0.0 起可用。</entry>
+ </row>
+ <row>
+ <entry><link
linkend="ini.date.sunrise-zenith">date.sunrise_zenith</link></entry>
+ <entry>"90.583333"</entry>
+ <entry>PHP_INI_ALL</entry>
+ <entry>从 PHP 5.0.0 起可用。</entry>
+ </row>
+ <row>
+ <entry><link
linkend="ini.date.sunset-zenith">date.sunset_zenith</link></entry>
+ <entry>"90.583333"</entry>
+ <entry>PHP_INI_ALL</entry>
+ <entry>从 PHP 5.0.0 起可用。</entry>
+ </row>
+ <row>
+ <entry><link
linkend="ini.date.timezone">date.timezone</link></entry>
+ <entry>""</entry>
+ <entry>PHP_INI_ALL</entry>
+ <entry>从 PHP 5.1.0 起可用。</entry>
+ </row>
+ <row>
+ <entry>dba.default_handler</entry>
+ <entry>""</entry>
+ <entry>PHP_INI_ALL</entry>
+ <entry>从 PHP 4.3.3 起可用。</entry>
+ </row>
+ <row>
+ <entry><link
linkend="ini.dbx.colnames-case">dbx.colnames_case</link></entry>
+ <entry>"unchanged"</entry>
+ <entry>PHP_INI_SYSTEM</entry>
+ <entry>从 PHP 4.3.0 起可用。 在 PHP 5.1.0 中移除该选项。</entry>
+ </row>
+ <row>
+ <entry><link
linkend="ini.default-charset">default_charset</link></entry>
+ <entry>""</entry>
+ <entry>PHP_INI_ALL</entry>
+ <entry></entry>
+ </row>
+ <row>
+ <entry><link
linkend="ini.default-mimetype">default_mimetype</link></entry>
+ <entry>"text/html"</entry>
+ <entry>PHP_INI_ALL</entry>
+ <entry></entry>
+ </row>
+ <row>
+ <entry><link
linkend="ini.default-socket-timeout">default_socket_timeout</link></entry>
+ <entry>"60"</entry>
+ <entry>PHP_INI_ALL</entry>
+ <entry>从 PHP 4.3.0 起可用。</entry>
+ </row>
+ <row>
+ <entry><link
linkend="ini.define-syslog-variables">define_syslog_variables</link></entry>
+ <entry>"0"</entry>
+ <entry>PHP_INI_ALL</entry>
+ <entry>在 PHP 5.4.0 中移除该选项。</entry>
+ </row>
+ <row>
+ <entry><link
linkend="ini.detect-unicode">detect_unicode</link></entry>
+ <entry>"1"</entry>
+ <entry>PHP_INI_ALL</entry>
+ <entry>从 PHP 5.1.0 起可用。 &removed.php.future;</entry>
+ </row>
+ <row>
+ <entry><link
linkend="ini.disable-classes">disable_classes</link></entry>
+ <entry>""</entry>
+ <entry>&php.ini; only</entry>
+ <entry>从 PHP 4.3.2 起可用。</entry>
+ </row>
+ <row>
+ <entry><link
linkend="ini.disable-functions">disable_functions</link></entry>
+ <entry>""</entry>
+ <entry>&php.ini; only</entry>
+ <entry>从 PHP 4.0.1 起可用。</entry>
+ </row>
+ <row>
+ <entry><link
linkend="ini.display-errors">display_errors</link></entry>
+ <entry>"1"</entry>
+ <entry>PHP_INI_ALL</entry>
+ <entry></entry>
+ </row>
+ <row>
+ <entry><link
linkend="ini.display-startup-errors">display_startup_errors</link></entry>
+ <entry>"0"</entry>
+ <entry>PHP_INI_ALL</entry>
+ <entry>从 PHP 4.0.3 起可用。</entry>
+ </row>
+ <row>
+ <entry><link linkend="ini.docref-ext">docref_ext</link></entry>
+ <entry>""</entry>
+ <entry>PHP_INI_ALL</entry>
+ <entry>从 PHP 4.3.2 起可用。</entry>
+ </row>
+ <row>
+ <entry><link linkend="ini.docref-root">docref_root</link></entry>
+ <entry>""</entry>
+ <entry>PHP_INI_ALL</entry>
+ <entry>从 PHP 4.3.0 起可用。</entry>
+ </row>
+ <row>
+ <entry><link linkend="ini.doc-root">doc_root</link></entry>
+ <entry>NULL</entry>
+ <entry>PHP_INI_SYSTEM</entry>
+ <entry></entry>
+ </row>
+ <row>
+ <entry><link linkend="ini.enable-dl">enable_dl</link></entry>
+ <entry>"1"</entry>
+ <entry>PHP_INI_SYSTEM</entry>
+ <entry>&removed.php.future;</entry>
+ </row>
+ <row>
+ <entry><link linkend="ini.engine">engine</link></entry>
+ <entry>"1"</entry>
+ <entry>PHP_INI_ALL</entry>
+ <entry>从 PHP 4.0.5 起可用。</entry>
+ </row>
+ <row>
+ <entry><link
linkend="ini.error-append-string">error_append_string</link></entry>
+ <entry>NULL</entry>
+ <entry>PHP_INI_ALL</entry>
+ <entry></entry>
+ </row>
+ <row>
+ <entry><link linkend="ini.error-log">error_log</link></entry>
+ <entry>NULL</entry>
+ <entry>PHP_INI_ALL</entry>
+ <entry></entry>
+ </row>
+ <row>
+ <entry><link
linkend="ini.error-prepend-string">error_prepend_string</link></entry>
+ <entry>NULL</entry>
+ <entry>PHP_INI_ALL</entry>
+ <entry></entry>
+ </row>
+ <row>
+ <entry><link
linkend="ini.error-reporting">error_reporting</link></entry>
+ <entry>NULL</entry>
+ <entry>PHP_INI_ALL</entry>
+ <entry></entry>
+ </row>
+ <row>
+ <entry>etpan.default.charset</entry>
+ <entry>"utf-8"</entry>
+ <entry>PHP_INI_ALL</entry>
+ <entry></entry>
+ </row>
+ <row>
+ <entry>etpan.default.protocol</entry>
+ <entry>"imap"</entry>
+ <entry>PHP_INI_ALL</entry>
+ <entry></entry>
+ </row>
+ <row>
+ <entry><link
linkend="ini.exif.decode-jis-intel">exif.decode_jis_intel</link></entry>
+ <entry>"JIS"</entry>
+ <entry>PHP_INI_ALL</entry>
+ <entry>从 PHP 4.3.0 起可用。</entry>
+ </row>
+ <row>
+ <entry><link
linkend="ini.exif.decode-jis-motorola">exif.decode_jis_motorola</link></entry>
+ <entry>"JIS"</entry>
+ <entry>PHP_INI_ALL</entry>
+ <entry>从 PHP 4.3.0 起可用。</entry>
+ </row>
+ <row>
+ <entry><link
linkend="ini.exif.decode-unicode-intel">exif.decode_unicode_intel</link></entry>
+ <entry>"UCS-2LE"</entry>
+ <entry>PHP_INI_ALL</entry>
+ <entry>从 PHP 4.3.0 起可用。</entry>
+ </row>
+ <row>
+ <entry><link
linkend="ini.exif.decode-unicode-motorola">exif.decode_unicode_motorola</link></entry>
+ <entry>"UCS-2BE"</entry>
+ <entry>PHP_INI_ALL</entry>
+ <entry>从 PHP 4.3.0 起可用。</entry>
+ </row>
+ <row>
+ <entry><link
linkend="ini.exif.encode-jis">exif.encode_jis</link></entry>
+ <entry>""</entry>
+ <entry>PHP_INI_ALL</entry>
+ <entry>从 PHP 4.3.0 起可用。</entry>
+ </row>
+ <row>
+ <entry><link
linkend="ini.exif.encode-unicode">exif.encode_unicode</link></entry>
+ <entry>"ISO-8859-15"</entry>
+ <entry>PHP_INI_ALL</entry>
+ <entry>从 PHP 4.3.0 起可用。</entry>
+ </row>
+ <row>
+ <entry><link
linkend="ini.exit-on-timeout">exit_on_timeout</link></entry>
+ <entry>""</entry>
+ <entry>PHP_INI_ALL</entry>
+ <entry>从 PHP 5.3 起可用。0</entry>
+ </row>
+ <row>
+ <entry><link
linkend="ini.expect.logfile">expect.logfile</link></entry>
+ <entry>""</entry>
+ <entry>PHP_INI_ALL</entry>
+ <entry></entry>
+ </row>
+ <row>
+ <entry><link
linkend="ini.expect.loguser">expect.loguser</link></entry>
+ <entry>"1"</entry>
+ <entry>PHP_INI_ALL</entry>
+ <entry></entry>
+ </row>
+ <row>
+ <entry><link
linkend="ini.expect.timeout">expect.timeout</link></entry>
+ <entry>"10"</entry>
+ <entry>PHP_INI_ALL</entry>
+ <entry></entry>
+ </row>
+ <row>
+ <entry><link linkend="ini.expose-php">expose_php</link></entry>
+ <entry>"1"</entry>
+ <entry>&php.ini; only</entry>
+ <entry></entry>
+ </row>
+ <row>
+ <entry><link linkend="ini.extension">extension</link></entry>
+ <entry>NULL</entry>
+ <entry>&php.ini; only</entry>
+ <entry></entry>
+ </row>
+ <row>
+ <entry><link
linkend="ini.extension-dir">extension_dir</link></entry>
+ <entry>"/path/to/php"</entry>
+ <entry>PHP_INI_SYSTEM</entry>
+ <entry></entry>
+ </row>
+ <row>
+ <entry><link
linkend="ini.fastcgi.impersonate">fastcgi.impersonate</link></entry>
+ <entry>"0"</entry>
+ <entry>PHP_INI_SYSTEM</entry>
+ <entry>在 PHP &lt;= 5.2.0 时是 PHP_INI_ALL。 从 PHP 4.3.0 起可用。
</entry>
+ </row>
+ <row>
+ <entry><link
linkend="ini.fastcgi.logging">fastcgi.logging</link></entry>
+ <entry>"1"</entry>
+ <entry>PHP_INI_SYSTEM</entry>
+ <entry>在 PHP &lt;= 5.2.0 时是 PHP_INI_ALL。 从 PHP 4.4.0 起可用。
</entry>
+ </row>
+ <row>
+ <entry>fbsql.allow_persistant</entry>
+ <entry>"1"</entry>
+ <entry>PHP_INI_SYSTEM</entry>
+ <entry>从 PHP 4.0.6 起可用。 在 PHP 4.2.0 中移除该选项。</entry>
+ </row>
+ <row>
+ <entry>fbsql.allow_persistent</entry>
+ <entry>"1"</entry>
+ <entry>PHP_INI_SYSTEM</entry>
+ <entry>从 PHP 4.2.0 起可用。</entry>
+ </row>
+ <row>
+ <entry>fbsql.autocommit</entry>
+ <entry>"1"</entry>
+ <entry>PHP_INI_SYSTEM</entry>
+ <entry>从 PHP 4.0.6 起可用。</entry>
+ </row>
+ <row>
+ <entry>fbsql.batchSize</entry>
+ <entry>"1000"</entry>
+ <entry>PHP_INI_SYSTEM</entry>
+ <entry>从 PHP 4.2.0 起可用。 在 PHP 5.1.0 中移除该选项。</entry>
+ </row>
+ <row>
+ <entry>fbsql.batchsize</entry>
+ <entry>"1000"</entry>
+ <entry>PHP_INI_ALL</entry>
+ <entry>从 PHP 5.1.0 起可用。</entry>
+ </row>
+ <row>
+ <entry>fbsql.default_database</entry>
+ <entry>""</entry>
+ <entry>PHP_INI_SYSTEM</entry>
+ <entry>从 PHP 4.0.6 起可用。</entry>
+ </row>
+ <row>
+ <entry>fbsql.default_database_password</entry>
+ <entry>""</entry>
+ <entry>PHP_INI_SYSTEM</entry>
+ <entry>从 PHP 4.0.6 起可用。</entry>
+ </row>
+ <row>
+ <entry>fbsql.default_host</entry>
+ <entry>NULL</entry>
+ <entry>PHP_INI_SYSTEM</entry>
+ <entry>从 PHP 4.0.6 起可用。</entry>
+ </row>
+ <row>
+ <entry>fbsql.default_password</entry>
+ <entry>""</entry>
+ <entry>PHP_INI_SYSTEM</entry>
+ <entry>从 PHP 4.0.6 起可用。</entry>
+ </row>
+ <row>
+ <entry>fbsql.default_user</entry>
+ <entry>"_SYSTEM"</entry>
+ <entry>PHP_INI_SYSTEM</entry>
+ <entry>从 PHP 4.0.6 起可用。</entry>
+ </row>
+ <row>
+ <entry>fbsql.generate_warnings</entry>
+ <entry>"0"</entry>
+ <entry>PHP_INI_SYSTEM</entry>
+ <entry>从 PHP 4.0.6 起可用。</entry>
+ </row>
+ <row>
+ <entry>fbsql.max_connections</entry>
+ <entry>"128"</entry>
+ <entry>PHP_INI_SYSTEM</entry>
+ <entry>从 PHP 4.0.6 起可用。</entry>
+ </row>
+ <row>
+ <entry>fbsql.max_links</entry>
+ <entry>"128"</entry>
+ <entry>PHP_INI_SYSTEM</entry>
+ <entry>从 PHP 4.0.6 起可用。</entry>
+ </row>
+ <row>
+ <entry>fbsql.max_persistent</entry>
+ <entry>"-1"</entry>
+ <entry>PHP_INI_SYSTEM</entry>
+ <entry>从 PHP 4.0.6 起可用。</entry>
+ </row>
+ <row>
+ <entry>fbsql.max_results</entry>
+ <entry>"128"</entry>
+ <entry>PHP_INI_SYSTEM</entry>
+ <entry>从 PHP 4.0.6 起可用。</entry>
+ </row>
+ <row>
+ <entry>fbsql.mbatchSize</entry>
+ <entry>"1000"</entry>
+ <entry>PHP_INI_SYSTEM</entry>
+ <entry>从 PHP 4.0.6 起可用。 在 PHP 4.2.0 中移除该选项。</entry>
+ </row>
+ <row>
+ <entry>fbsql.show_timestamp_decimals</entry>
+ <entry>"0"</entry>
+ <entry>PHP_INI_SYSTEM</entry>
+ <entry>从 PHP 5.1.5 起可用。</entry>
+ </row>
+ <row>
+ <entry><link linkend="ini.file-uploads">file_uploads</link></entry>
+ <entry>"1"</entry>
+ <entry>PHP_INI_SYSTEM</entry>
+ <entry>在 PHP &lt;= 4.2.3 时是 PHP_INI_ALL。 从 PHP 4.0.3 起可用。
</entry>
+ </row>
+ <row>
+ <entry><link
linkend="ini.filter.default">filter.default</link></entry>
+ <entry>"unsafe_raw"</entry>
+ <entry>PHP_INI_PERDIR</entry>
+ <entry>在 filter &lt;= 0.9.4 时是 PHP_INI_ALL。 从 PHP 5.2.0 起可
用。</entry>
+ </row>
+ <row>
+ <entry><link
linkend="ini.filter.default-flags">filter.default_flags</link></entry>
+ <entry>NULL</entry>
+ <entry>PHP_INI_PERDIR</entry>
+ <entry>在 filter &lt;= 0.9.4 时是 PHP_INI_ALL。 从 PHP 5.2.0 起可
用。</entry>
+ </row>
+ <row>
+ <entry><link linkend="ini.from">from</link></entry>
+ <entry>""</entry>
+ <entry>PHP_INI_ALL</entry>
+ <entry></entry>
+ </row>
+ <row>
+ <entry><link
linkend="ini.image.jpeg-ignore-warning">gd.jpeg_ignore_warning</link></entry>
+ <entry>"0"</entry>
+ <entry>PHP_INI_ALL</entry>
+ <entry>从 PHP 5.1.3 起可用。</entry>
+ </row>
+ <row>
+ <entry>geoip.custom_directory</entry>
+ <entry>NULL</entry>
+ <entry>PHP_INI_ALL</entry>
+ <entry>从 geoip 1.0.1 起可用。</entry>
+ </row>
+ <row>
+ <entry>geoip.database_standard</entry>
+ <entry>"GeoIP.dat"</entry>
+ <entry>PHP_INI_ALL</entry>
+ <entry>在 geoip 1.0.1 中移除该选项。</entry>
+ </row>
+ <row>
+ <entry><link linkend="ini.gpc-order">gpc_order</link></entry>
+ <entry>"GPC"</entry>
+ <entry>PHP_INI_ALL</entry>
+ <entry>在 PHP 5.0.0 中移除该选项。</entry>
+ </row>
+ <row>
+ <entry>hidef.ini_path</entry>
+ <entry>(char*)default_ini_path</entry>
+ <entry>PHP_INI_SYSTEM</entry>
+ <entry></entry>
+ </row>
+ <row>
+ <entry><link
linkend="ini.syntax-highlighting">highlight.bg</link></entry>
+ <entry>"#FFFFFF"</entry>
+ <entry>PHP_INI_ALL</entry>
+ <entry>在 PHP 5.4.0 中移除该选项。</entry>
+ </row>
+ <row>
+ <entry><link
linkend="ini.syntax-highlighting">highlight.comment</link></entry>
+ <entry>"#FF8000"</entry>
+ <entry>PHP_INI_ALL</entry>
+ <entry></entry>
+ </row>
+ <row>
+ <entry><link
linkend="ini.syntax-highlighting">highlight.default</link></entry>
+ <entry>"#0000BB"</entry>
+ <entry>PHP_INI_ALL</entry>
+ <entry></entry>
+ </row>
+ <row>
+ <entry><link
linkend="ini.syntax-highlighting">highlight.html</link></entry>
***The diff for this file has been truncated for email.***
=======================================
--- /dev/null
+++ /trunk/xml/appendices/ini.sections.xml Mon Apr 9 09:11:24 2012
@@ -0,0 +1,122 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- $Revision: 324974 $ -->
+<!-- EN-Revision: 323642 Maintainer: HonestQiao Status: ready -->
+<!-- Reviewed: no Maintainer: HonestQiao -->
+<section xml:id="ini.sections" xmlns="http://docbook.org/ns/docbook"
xmlns:xlink="http://www.w3.org/1999/xlink">
+ <title> &php.ini; 配置段列表</title>
+ <para>
+ This list includes the &php.ini; sections you can set to configure your
+ PHP setup on a per Host or Path basis. These sections are optional.
+ </para>
+ <para>
+ These sections don't directly affect PHP. They are used to group other
+ &php.ini; directives together and to get them to act upon a particular
host
+ or on a particular path.
+ </para>
+ <para>
+ These sections are used only in CGI/FastCGI mode and they can not set
+ <link linkend="ini.extension">extension</link> and <link
+ linkend="ini.zend-extension">zend_extension</link> directives.
+ </para>
+ <para>
+ <table>
+ <title>配置段</title>
+ <tgroup cols="3">
+ <thead>
+ <row>
+ <entry>&Name;</entry>
+ <entry>&Changeable;</entry>
+ <entry>&Changelog;</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry><link linkend="ini.per-host">[HOST=]</link></entry>
+ <entry>PHP_INI_SYSTEM</entry>
+ <entry>在 PHP 5.3.0 时增加。</entry>
+ </row>
+ <row>
+ <entry><link linkend="ini.per-path">[PATH=]</link></entry>
+ <entry>PHP_INI_SYSTEM</entry>
+ <entry>在 PHP 5.3.0 时增加。</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ </para>
+
+ &ini.descriptions.title;
+
+ <para>
+ <variablelist>
+ <varlistentry xml:id="ini.per-host">
+ <term>
+ <parameter>[HOST=&lt;host&gt;]</parameter>
+ </term>
+ <listitem>
+ <para>
+ This section allows you to define a set of &php.ini; directives that
+ will take effect on the named host.
+ </para>
+ <para>
+ <example>
+ <title>Activate full on-screen error reporting for dev.
domain</title>
+ <programlisting role="php.ini">
+<![CDATA[
+[HOST=dev.site.com]
+error_reporting = E_ALL
+display_errors = On
+]]>
+ </programlisting>
+ </example>
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry xml:id="ini.per-path">
+ <term>
+ <parameter>[PATH=&lt;path&gt;]</parameter>
+ </term>
+ <listitem>
+ <para>
+ This section allows you to define a set of &php.ini; directives that
+ will take effect when a script runs from the named path.
+ </para>
+ <para>
+ <example>
+ <title>Add security script for protected areas</title>
+ <programlisting role="php.ini">
+<![CDATA[
+[PATH=/home/site/public/secure]
+auto_prepend_file=security.php
+]]>
+ </programlisting>
+ </example>
+ </para>
+ </listitem>
+ </varlistentry>
+
+ </variablelist>
+ </para>
+ </section>
+
+<!-- Keep this comment at the end of the file
+Local variables:
+mode: sgml
+sgml-omittag:t
+sgml-shorttag:t
+sgml-minimize-attributes:nil
+sgml-always-quote-attributes:t
+sgml-indent-step:1
+sgml-indent-data:t
+indent-tabs-mode:nil
+sgml-parent-document:nil
+sgml-default-dtd-file:"~/.phpdoc/manual.ced"
+sgml-exposed-tags:nil
+sgml-local-catalogs:nil
+sgml-local-ecat-files:nil
+End:
+vim600: syn=xml fen fdm=syntax fdl=2 si
+vim: et tw=78 syn=sgml
+vi: ts=1 sw=1
+-->
=======================================
--- /dev/null
+++ /trunk/xml/appendices/ini.xml Mon Apr 9 09:11:24 2012
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- $Revision: 324974 $ -->
+<!-- EN-Revision: 322056 Maintainer: HonestQiao Status: ready -->
+<!-- Reviewed: no Maintainer: HonestQiao -->
+<appendix xml:id="ini" xmlns="http://docbook.org/ns/docbook"
xmlns:xlink="http://www.w3.org/1999/xlink">
+ <title>&php.ini; 配置</title>
+
+ &appendices.ini.list;
+ &appendices.ini.sections;
+ &appendices.ini.core;
+
+</appendix>
+
+<!-- Keep this comment at the end of the file
+Local variables:
+mode: sgml
+sgml-omittag:t
+sgml-shorttag:t
+sgml-minimize-attributes:nil
+sgml-always-quote-attributes:t
+sgml-indent-step:1
+sgml-indent-data:t
+indent-tabs-mode:nil
+sgml-parent-document:nil
+sgml-default-dtd-file:"~/.phpdoc/manual.ced"
+sgml-exposed-tags:nil
+sgml-local-catalogs:nil
+sgml-local-ecat-files:nil
+End:
+vim600: syn=xml fen fdm=syntax fdl=2 si
+vim: et tw=78 syn=sgml
+vi: ts=1 sw=1
+-->
=======================================
--- /dev/null
+++ /trunk/xml/appendices/migration5.xml Mon Apr 9 09:11:24 2012
@@ -0,0 +1,886 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- $Revision: 324974 $ -->
+<!-- EN-Revision: 324522 Maintainer: HonestQiao Status: ready -->
+<!-- Reviewed: no Maintainer: HonestQiao -->
+<appendix xml:id="migration5" xmlns="http://docbook.org/ns/docbook"
xmlns:xlink="http://www.w3.org/1999/xlink">
+ <title>从 PHP 4 移植到 PHP 5</title>
+ <para>
+ &manual.migration.seealso;
+ <link linkend="migration51">5.1.x</link>,
+ <link linkend="migration52">5.2.x</link> and
+ <link linkend="migration53">5.3.x</link>.
+ </para>
+ <section xml:id="migration5.changes">
+ <title>PHP 5 中有哪些改变</title>
+ <para>
+ PHP 5 和集成的 Zend Engine 2 代极大提高了 PHP
+ 的性能和能力,而且投入极大努力尽可能避免破坏已有的代码的使用。因此将代
码从
+ PHP 4 移植到 PHP 5 应该很容易。大多数已有的 PHP 4
+ 代码应该不用改就能运行,但还是应该注意到<link
+ linkend="migration5.incompatible">几点区别</link>并在实际运作环境下转换
到新版本之前多做测试。
+ </para>
+ </section>
+
+ <section xml:id="migration5.incompatible">
+ <title>未向下兼容的改变</title>
+ <para>
+ 尽管大部分 PHP 4 的代码应该不用修改就能运行,还是应该留意以下不向下兼容
的改变:
+ </para>
+ <itemizedlist>
+ <listitem>
+ <simpara>
+ 有了一些<link linkend="reserved.keywords">新关键字</link>。
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ <function>strrpos</function> 和 <function>strripos</function>
+ 如今使用整个字符串作为 needle。
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ 非法使用字符串偏移量会导致 <constant>E_ERROR</constant> 而不是
+ <constant>E_WARNING</constant>。一个非法使用的例子:<literal>$str
= 'abc'; unset($str[0]);</literal>.
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ <function>array_merge</function> 被改成只接受数组。如果传递入非数组变
量,对每个此类参数都会发出一条
+ <constant>E_WARNING</constant> 信息。要小心因为你的代码有可能疯狂发出
+ <constant>E_WARNING</constant>。
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ PATH_TRANSLATED 服务器变量在 Apache2 SAPI 中不再暗中设定,这和 PHP 4
+ 中的情形相反,如果 Apache 没产生此值则其被设为和
+ SCRIPT_FILENAME 服务器变量一样的值。此修改是为了遵守
+ <link xlink:href="&url.rfc;3875">CGI 规范</link>。更多信息见 <link
+ xlink:href="&url.php.bugs;23610">bug #23610</link>,并参考手册中
+ <link
linkend="reserved.variables.server">$_SERVER['PATH_TRANSLATED']</link>
+ 的说明。此问题也影响到 PHP &gt;= 4.3.2 的版本。
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ <link linkend="ref.tokenizer">Tokenizer</link> 扩展不再定义
+ <constant>T_ML_COMMENT</constant> 常量。如果把
+ error_reporting 设为 <constant>E_ALL</constant>,PHP
+ 将产生一条消息。尽管 <constant>T_ML_COMMENT</constant>
+ 从来都没用到过,还是在 PHP 4 中定义了。在 PHP 4 和 PHP 5
+ 中 // 和 /* */ 都被解析为 <constant>T_COMMENT</constant>
+ 常量。但是 PHPDoc 风格的注释 /** */,自 PHP 5 开始被
+ PHP 解析,被识别为 <constant>T_DOC_COMMENT</constant>。
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ 如果 <link linkend="ini.variables-order">variables_order</link>
+ 包括"S",$_SERVER 应该带有 argc 和 argv 被产生。如果用户特别配制系统
不创建
+ $_SERVER,那此变量当然就不存在了。改变的地方是不管 <link
+ linkend="ini.variables-order">variables_order</link> 怎么设定,在
+ CLI 版本中 argc 和 argv 总是可用的。本来 CLI
+ 版不是总会产生全局变量 $argc 和 $argv 的。
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ 没有属性的对象不再被当成"empty"。
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ 有些情况下类必须在使用前被定义。这仅在使用了一些 PHP 5
+ 的新特性(例如 <link
linkend="language.oop5.interfaces">interfaces</link>)的时候发生。其它情况下
行为都没变。
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ <function>get_class</function>,<function>get_parent_class</function>
+ 和 <function>get_class_methods</function>
+ 如今返回的类/方法名和定义时的名字一致(区分大小写),对于依赖以前行
为(类/方法名总是返回小写的)的老脚本可能产生问题。一个可能的解决方法是在脚
本中搜索所有这些函数并使用
+ <function>strtolower</function>。
+ </simpara>
+ <simpara>
+ 区分大小写的改变也适用于<link
+ linkend="language.constants.predefined">魔术常量</link>
+ <constant>__CLASS__</constant>,<constant>__METHOD__</constant>
+ 和 <constant>__FUNCTION__</constant>。其值都会严格按照定义时的名字返
回(区分大小写)。
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ <function>ip2long</function> 在传递入一个非法
+ IP 作为参数时返回 &false;,不再是
+ <literal>-1</literal>。
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ 如果有函数定义在包含文件中,则这些函数可以在主文件中使用而与是否在
+ <function>return</function> 指令之前还是之后无关。如果文件被包含两
次,PHP 5
+ 会发出致命错误,因为函数已经被定义,而 PHP 4
+ 不管这个。因此推荐使用 <function>include_once</function>
+ 而不要去检查文件是否已被包含以及在包含文件中有条件返回。
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ <function>include_once</function> 和
<function>require_once</function>
+ 在 Windows 下先将路径规格化,因此包含
+ A.php 和 a.php 只会把文件包含一次。
+ </simpara>
+ </listitem>
+ </itemizedlist>
+
+ <para>
+ <example>
+ <title>
+ <function>strrpos</function> 和 <function>strripos</function>
+ 如今用整个字符串作为 needle
+ </title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+var_dump(strrpos('ABCDEF','DEF')); //int(3)
+
+var_dump(strrpos('ABCDEF','DAF')); //bool(false)
+?>
+]]>
+ </programlisting>
+ </example>
+ </para>
+ <para>
+ <example>
+ <title>没有属性的对象不再被当成"empty"</title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+class test { }
+$t = new test();
+
+var_dump(empty($t)); // echo bool(false)
+
+if ($t) {
+ // Will be executed
+}
+?>
+]]>
+ </programlisting>
+ </example>
+ </para>
+ <para>
+ <example>
+ <title>有些情况下类必须在使用之前定义</title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+
+//works with no errors:
+$a = new a();
+class a {
+}
+
+
+//throws an error:
+$a = new b();
+
+interface c{
+}
+class b implements c {
+}
+
+?>
+]]>
+ </programlisting>
+ </example>
+ </para>
+ </section>
+
+ <section xml:id="migration5.cli-cgi">
+ <title>CLI 和 CGI</title>
+ <para>
+ PHP 5 中对 CLI 和 CGI 文件名作了些改变。PHP 5 中,CGI
+ 版本被改名为 <filename>php-cgi.exe</filename>(以前是
+ <filename>php.exe</filename>),现在主目录中的是 CLI 版本(之前是
+ <filename>cli/php.exe</filename>)。
+ </para>
+ <para>
+ PHP 5 中引进了一种新模式:<filename>php-win.exe</filename>。这和 CLI
+ 版本相同,只除了 php-win 不输出任何内容,因此不会提供控制台(屏幕上不会
闪过"dos
+ 窗口")。此行为类似 php-gtk。
+ </para>
+ <para>
+ PHP 5 中,CLI 版本总会产生全局变量
+ <varname>$argv</varname> 和 <varname>$argc</varname>
+ 而不管 &php.ini; 是怎么设的。即使将
+ <link linkend="ini.register-argc-argv">register_argc_argv</link>
+ 设为 <literal>off</literal> 也不影响 CLI。
+ </para>
+ <para>
+ 参见<link linkend="features.commandline">命令行模式</link>。
+ </para>
+ </section>
+
+ <section xml:id="migration5.configuration">
+ <title>移植配置文件</title>
+ <para>
+ 由于 ISAPI 模块的名字改了,从 php4xxx 改为
+ php5xxx,因此需要对配置文件作些修改。CLI 和 CGI
+ 文件名也改了。更多信息请查看<link
+ linkend="migration5.cli-cgi">相应章节</link>。
+ </para>
+ <para>
+ 移植 Apache 配置极其简单。照下面的例子来检查需要做的修改:
+ <example>
+ <title>移植 Apache 配置文件到 PHP 5</title>
+ <programlisting role="apache-conf">
+<![CDATA[
+# 将下面这行:
+LoadModule php4_module /php/sapi/php4apache2.dll
+
+# 改成这一行:
+LoadModule php5_module /php/php5apache2.dll
+]]>
+ </programlisting>
+ </example>
+ </para>
+ <para>
+ 如果 web 服务器是以 CGI 模式运行 PHP 的,应该注意 CGI 版本的名字从
+ <filename>php.exe</filename> 改为了
+ <filename>php-cgi.exe</filename>。在 Apache 中,应该照这样改:
+ <example>
+ <title>移植 Apache 配置文件到 PHP 5,CGI 模式</title>
+ <programlisting role="apache-conf">
+<![CDATA[
+# 将下面这行:
+Action application/x-httpd-php "/php/php.exe"
+
+# 改成这一行:
+Action application/x-httpd-php "/php/php-cgi.exe"
+]]>
+ </programlisting>
+ </example>
+ </para>
+ <para>
+ 其它的 web 服务器中,需要修改 CGI 或者 ISAPI 模块的名字。
+ </para>
+ </section>
+
+ <section xml:id="migration5.functions">
+ <title>新函数</title>
+ <para>
+ PHP 5 有了些新函数。下面是列表:
+ </para>
+ <para><link linkend="ref.array">Arrays</link>:</para>
+ <itemizedlist>
+ <listitem>
+ <simpara>
+ <function>array_combine</function> -
+ 用一个数组作为键名,另一个数组作为值创建一个新数组
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ <function>array_diff_uassoc</function> -
+ 计算数组的差别,并用用户提供的回调函数作附加的索引检查
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ <function>array_udiff</function> -
+ 用回调函数比较数据来计算数组的差别
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ <function>array_udiff_assoc</function> -
+ 计算数组的差别并作附加的索引检查。用回调函数来比较数据
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ <function>array_udiff_uassoc</function> -
+ 计算数组的差别并作附加的索引检查。数据的比较和索引检查都用回调函数来
完成
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ <function>array_walk_recursive</function> -
+ 对数组的每个成员递归使用用户函数
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ <function>array_uintersect_assoc</function> -
+ 计算数组的交集并作附加的索引检查。用回调函数来比较数据
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ <function>array_uintersect_uassoc</function> -
+ 计算数组的交集并作附加的索引检查。数据和索引都用回调函数来比较
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ <function>array_uintersect</function> -
+ 计算数组的交集。用回调函数来比较数据
+ </simpara>
+ </listitem>
+ </itemizedlist>
+
+ <para><link linkend="ref.ibase">InterBase</link>:</para>
+ <itemizedlist>
+ <listitem>
+ <simpara>
+ <function>ibase_affected_rows</function> -
+ 返回前一个查询影响到的行的数目
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ <function>ibase_backup</function> -
+ 在服务管理器中发起一个后台任务并立即返回
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ <function>ibase_commit_ret</function> -
+ 提交一个事务但不关闭
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ <function>ibase_db_info</function> -
+ 请求有关数据库的统计信息
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ <function>ibase_drop_db</function> -
+ 删除一个数据库
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ <function>ibase_errcode</function> -
+ 返回一个错误代码
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ <function>ibase_free_event_handler</function> -
+ 取消一个已注册的事件句柄
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ <function>ibase_gen_id</function> -
+ 递增指定的发生器并返回其新值
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ <function>ibase_maintain_db</function> -
+ 在数据库服务器上执行一条维护命令
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ <function>ibase_name_result</function> -
+ 给结果集指定一个名字
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ <function>ibase_num_params</function> -
+ 返回一个准备好的查询的参数数目
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ <function>ibase_param_info</function> -
+ 返回一个准备好的查询的参数信息
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ <function>ibase_restore</function> -
+ 在服务管理器中发起一个还原任务并立即返回
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ <function>ibase_rollback_ret</function> -
+ 回卷一笔事务并保留事务上下文
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ <function>ibase_server_info</function> -
+ 请求有关数据库服务器的统计信息
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ <function>ibase_service_attach</function> -
+ 连接到服务管理器
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ <function>ibase_service_detach</function> -
+ 从服务管理器断开
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ <function>ibase_set_event_handler</function> -
+ 注册一个当事件发布时要调用的回调函数
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ <function>ibase_wait_event</function> -
+ 等待数据库发布一条事件
+ </simpara>
+ </listitem>
+ </itemizedlist>
+
+ <para><link linkend="ref.iconv">iconv</link>:</para>
+ <itemizedlist>
+ <listitem>
+ <simpara>
+ <function>iconv_mime_decode</function> -
+ 解码 MIME 头信息字段
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ <function>iconv_mime_decode_headers</function> -
+ 一次解码多个 MIME 头信息字段
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ <function>iconv_mime_encode</function> -
+ 压缩 MIME 头信息字段
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ <function>iconv_strlen</function> -
+ 返回字符串中的字符计数
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ <function>iconv_strpos</function> -
+ 在堆栈中找到第一个出现的子串位置
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ <function>iconv_strrpos</function> -
+ 在堆栈中找到最后一个出现的子串位置
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ <function>iconv_substr</function> -
+ 从字符串中取出一部分
+ </simpara>
+ </listitem>
+ </itemizedlist>
+
+ <para><link linkend="ref.stream">Streams</link>:</para>
+ <itemizedlist>
+ <listitem>
+ <simpara>
+ <function>stream_copy_to_stream</function> -
+ 把一个流的数据复制到另一个流
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ <function>stream_get_line</function> -
+ 根据给定的分隔符中流中读取一行
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ <function>stream_socket_accept</function> - 接受一个由
+ <function>stream_socket_server</function> 建立的 socket 连接
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ <function>stream_socket_client</function> - 打开一个 Internet 或 Unix
+ 域的 socket 连接
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ <function>stream_socket_get_name</function> - 获取本地或远程的
sockets
+ 名字
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ <function>stream_socket_recvfrom</function> - 从 socket
+ 获取数据(不管连接是否已经建立)
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ <function>stream_socket_sendto</function> - 向 socket
+ 发送一个消息(不管连接是否已经建立)
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ <function>stream_socket_server</function> - 建立一个 Internet 或 Unix
+ 域服务器的 socket
+ </simpara>
+ </listitem>
+ </itemizedlist>
+
+ <para><link linkend="ref.datetime">Date/Time</link>:</para>
+ <itemizedlist>
+ <listitem>
+ <simpara>
+ <function>idate</function> - 将本地时间格式化为整数
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ <function>date_sunset</function> - 计算所指定日期和地点的日落时间
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ <function>date_sunrise</function> - T计算所指定日期和地点的日出时间
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ <function>time_nanosleep</function> - 廷迟执行程若干秒和若干纳秒
+ </simpara>
+ </listitem>
+ </itemizedlist>
+
+ <para><link linkend="ref.strings">Strings</link>:</para>
+ <itemizedlist>
+ <listitem>
+ <simpara>
+ <function>str_split</function> - 把一个字符串分割为数组
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ <function>strpbrk</function> - 在一字符串中搜索给定的字符集合中的任意
一个字符
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ <function>substr_compare</function> - 以二进制的形式比较两个字符
串,从第一个字符串的
+ offset 开始,直到到达长度为 length 时结束,可自定义是否大小写敏感比较
+ </simpara>
+ </listitem>
+ </itemizedlist>
+
+ <para>Other:</para>
+ <itemizedlist>
+ <listitem>
+ <simpara>
+ <function>convert_uudecode</function> - 解码 uuencoded 的字符串
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ <function>convert_uuencode</function> - 对字符串进行 uuencode
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ <function>curl_copy_handle</function> - 复制一个 cURL 句柄及其所有参

+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ <function>dba_key_split</function> - 把一个键分隔为字符串数组
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ <function>dbase_get_header_info</function> - 取得 dBase 数据库的头部
信息
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ <function>dbx_fetch_row</function> - 获取结果集中被设置为
DBX_RESULT_UNBUFFERED
+ 的行
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ <function>fbsql_set_password</function> - 修改指定用户的密码
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ <function>file_put_contents</function> - 向一个文件内写入字符串
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ <function>ftp_alloc</function> - 为准备上传的文件分配空间
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ <function>get_declared_interfaces</function> - 以数组的形式返回所有已
定义的接品
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ <function>get_headers</function> - 获取服务器响应 HTTP
+ 请求时的所有头部信息
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ <function>headers_list</function> - 返回所有已发送或准备发送响应头部
列表
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ <function>http_build_query</function> - 生成一个已经过 URL 编码的请求
字符串
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ <function>image_type_to_extension</function> - 根据
+ <function>getimagesize</function>,
+ <function>exif_read_data</function>,
+ <function>exif_thumbnail</function>,
+ <function>exif_imagetype</function> 所返回的 image-type 取得文件名后

+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ <function>imagefilter</function> - 对图像应用滤镜
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ <function>imap_getacl</function> - 获取指定邮箱的 ACL
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ <function>ldap_sasl_bind</function> - 使用 SASL 绑定到 LDAP 目录
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ <function>mb_list_encodings</function> - 以数组的形式返回所支持的全部
字符集
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ <function>pcntl_getpriority</function> - 获得任意一个进程的优先级
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ <function>pcntl_wait</function> - Waits on or returns the status of a
+ forked child as defined by the waitpid() system call
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ <function>pg_version</function> - 返回一个包含客户端、协议和服务器版
本的数组
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ <function>php_check_syntax</function> - 检查指定文件的语法
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ <function>php_strip_whitespace</function> - 返回已经去除注释和空白的
源代码
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ <function>proc_nice</function> - 修改当前进程的优前级
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ <function>pspell_config_data_dir</function> - 修改语言文件的位置
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ <function>pspell_config_dict_dir</function> - 修改主要单词列表的位置
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ <function>setrawcookie</function> - 发送一个没有经过 url 编码的
cookie
+ 值
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ <function>scandir</function> -
+ 列中指定目录中的所有子目录和文件
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ <function>snmp_read_mib</function> - 在一个可用的 MIB 树中读取和分板
一个
+ MIB 文件
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ <function>sqlite_fetch_column_types</function> -
+ 以数组的形式返回一张表中的列类型
+ </simpara>
+ </listitem>
+ </itemizedlist>
+ <note>
+ <para>
+ <link linkend="ref.tidy">Tidy</link> 扩展库的 API 也作了重大调整
+ </para>
+ </note>
+ </section>
+
+
+ <section xml:id="migration5.newconf">
+ <title>新指令</title>
+ <para>
+ PHP 5 在 &php.ini; 中引进了一些新指令。列表如下:
+ </para>
+ <itemizedlist>
+ <listitem>
+ <simpara>
+ mail.force_extra_parameters -
+ 强制指定的参数附加值作为额外的参数传递给 sendmail 库。这些参数总是会
替换掉
+ <function>mail</function> 的第 5 个参数,即使在安全模式下
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ <link linkend="ini.register-long-arrays">register_long_arrays</link>
-
+ 允许/禁止 PHP 注册已过时的 $HTTP_*_VARS 变量
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ <link
linkend="ini.session.hash-function">session.hash_function</link> -
+ 选择一种散列函数(MD5 或 SHA-1)
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ <link
linkend="ini.session.hash-bits-per-character">session.hash_bits_per_character</link>
-
+ 定义将二进制散列数据转换为可读格式时每个字符中储存几个位(从 4 到 6)
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ <link
linkend="ini.zend.ze1-compatibility-mode">zend.ze1_compatibility_mode</link>
-
+ 启用 Zend Engline 1 代(PHP 4)兼容模式
+ </simpara>
+ </listitem>
+ </itemizedlist>
+ </section>
+
+ <section xml:id="migration5.databases">
+ <title>数据库</title>
+ <para>
+ 关于数据库(MySQL 和 SQLite)在 PHP 5 中有些改变。
+ </para>
+ <para>
+ PHP 5 中不再绑定 MySQL 客户端连接库,因为授权和一些其它问题。更多信息见
+ <link linkend="faq.databases.mysql.php5">FAQ</link>。
+ </para>
+ <para>
+ 有个新扩展库 <link linkend="ref.mysqli">MySQLi(改良版
+ MySQL)</link>,设计用来工作于 MySQL 4.1 及更高版本之下。
+ </para>
+ <para>
+ 自 PHP 5 起,<link linkend="ref.sqlite">SQLite</link> 扩展库内置在
+ PHP 中。SQLite 是一个可嵌入 SQL
+ 数据库引擎,不是客户端连接库用来连接大型数据库服务器(如 MySQL 或
+ PostgreSQL)的。SQLite 库直接读写磁盘上的数据库文件。
+ </para>
+ </section>
+
+
+ <section xml:id="migration5.oop">
+ <title>新对象模型</title>
+ <para>
+ PHP 5 中有个新对象模型(Object Model)。PHP
+ 处理对象的方式完全重写了,允许更佳性能和更多特性。之前版本的
+ PHP,对象处理方式和原始类型(例如整型和字符串)相同。此方法的缺点是当变
量被赋值或作为参数传递给方法时语义上整个对象都被拷贝。在新方法中,对象通过句
柄引用,而不是值(可以将句柄当成是对象的标识符)。
+ </para>
+ <para>
+ 很多 PHP 程序员根本没意识到旧的对象模型的这种拷贝怪癖,因此大多数 PHP
+ 应用程序拿来就能运行,或者只做很小的修改。
+ </para>
+ <para>
+ 新对象模型的文档见<link
+ linkend="language.oop5">语言参考</link>。
+ </para>
+ <para>
+ 与 PHP 4 的兼容性参见 <link
+
linkend="ini.zend.ze1-compatibility-mode">zend.ze1_compatibility_mode</link>。
+ </para>
+ </section>
+
+ <section xml:id="migrating5.errorrep">
+ <title>错误报告</title>
+ <para>
+ 自 PHP 5 起引进了新常量 E_STRICT,其值为
+ 2048。它提供了对用户代码的协同性和向前兼容性的运行时 PHP
+ 建议,有助于使用户保持最新和最好的编程风格。例如在使用已过时的函数时
+ STRICT 信息会提出警告。
+ </para>
+ <note>
+ <simpara>
+ E_ALL 不包括 E_STRICT,因此其默认未激活。
+ </simpara>
+ </note>
+ </section>
+
+ </appendix>
+
+
+<!-- Keep this comment at the end of the file
+Local variables:
+mode: sgml
+sgml-omittag:t
+sgml-shorttag:t
+sgml-minimize-attributes:nil
+sgml-always-quote-attributes:t
+sgml-indent-step:1
+sgml-indent-data:t
+indent-tabs-mode:nil
+sgml-parent-document:nil
+sgml-default-dtd-file:"~/.phpdoc/manual.ced"
+sgml-exposed-tags:nil
+sgml-local-catalogs:nil
+sgml-local-ecat-files:nil
+End:
+vim600: syn=xml fen fdm=syntax fdl=2 si
+vim: et tw=78 syn=sgml
+vi: ts=1 sw=1
+-->
=======================================
--- /dev/null
+++ /trunk/xml/appendices/reserved.xml Mon Apr 9 09:11:24 2012
@@ -0,0 +1,390 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- $Revision: 324974 $ -->
+<!-- EN-Revision: 324522 Maintainer: HonestQiao Status: ready -->
+<!-- Reviewed: no Maintainer: HonestQiao -->
+<!-- CREDITS: dallas -->
+<appendix xml:id="reserved" xmlns="http://docbook.org/ns/docbook"
xmlns:xlink="http://www.w3.org/1999/xlink">
+ <title>保留字列表</title>
+ <para>
+ 以下是 PHP 中预定义标识符的列表。没有列在下面的标识符可以在脚本中作为自定
义标识符使用。这些列表包括关键字和预定义变量、常量和类名。这些列表可能有遗
漏,它是不完整的。
+ </para>
+
+ <sect1 xml:id="reserved.keywords">
+ <title>关键词列表</title>
+ <simpara>
+ 这些词语在 PHP 中有着特殊的意义。它们中有些像是函数,有些像是常量......但是
它们不是的,它们只是语言结构的一部分。不能使用它们的任何一个作为常量、方法名
或是类名。但是可以将它们作为变量名使用,不过这样会导致混淆。
+ </simpara>
+
+ <table>
+ <title>PHP 关键词</title>
+ <tgroup cols="5">
+ <tbody>
+ <row>
+ <entry>
+ <link linkend="language.operators.logical">and</link>
+ </entry>
+ <entry>
+ <link linkend="language.operators.logical">or</link>
+ </entry>
+ <entry>
+ <link linkend="language.operators.logical">xor</link>
+ </entry>
+ <entry>
+ <link linkend="language.constants.predefined">__FILE__</link>
+ </entry>
+ <entry>
+ <link linkend="reserved.classes.php5">exception</link> (PHP 5)
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <link linkend="language.constants.predefined">__LINE__</link>
+ </entry>
+ <entry>
+ <function>array</function>
+ </entry>
+ <entry>
+ <link linkend="control-structures.foreach">as</link>
+ </entry>
+ <entry>
+ <link linkend="control-structures.break">break</link>
+ </entry>
+ <entry>
+ <link linkend="control-structures.switch">case</link>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <link linkend="keyword.class">class</link>
+ </entry>
+ <entry>
+ <link linkend="language.oop5.constants">const</link>
+ </entry>
+ <entry>
+ <link linkend="control-structures.continue">continue</link>
+ </entry>
+ <entry>
+ <link linkend="control-structures.declare">declare</link>
+ </entry>
+ <entry>
+ <link linkend="control-structures.switch">default</link>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <function>die</function>
+ </entry>
+ <entry>
+ <link linkend="control-structures.do.while">do</link>
+ </entry>
+ <entry>
+ <function>echo</function>
+ </entry>
+ <entry>
+ <link linkend="control-structures.else">else</link>
+ </entry>
+ <entry>
+ <link linkend="control-structures.elseif">elseif</link>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <function>empty</function>
+ </entry>
+ <entry>
+ <link linkend="control-structures.declare">enddeclare</link>
+ </entry>
+ <entry>
+ <link linkend="control-structures.alternative-syntax">endfor</link>
+ </entry>
+ <entry>
+ <link
linkend="control-structures.alternative-syntax">endforeach</link>
+ </entry>
+ <entry>
+ <link linkend="control-structures.alternative-syntax">endif</link>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <link
linkend="control-structures.alternative-syntax">endswitch</link>
+ </entry>
+ <entry>
+ <link
linkend="control-structures.alternative-syntax">endwhile</link>
+ </entry>
+ <entry>
+ <function>eval</function>
+ </entry>
+ <entry>
+ <function>exit</function>
+ </entry>
+ <entry>
+ <link linkend="keyword.class">extends</link>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <link linkend="control-structures.for">for</link>
+ </entry>
+ <entry>
+ &foreach;
+ </entry>
+ <entry>
+ <link linkend="functions.user-defined">function</link>
+ </entry>
+ <entry>
+ <link linkend="language.variables.scope">global</link>
+ </entry>
+ <entry>
+ <link linkend="control-structures.if">if</link>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <function>include</function>
+ </entry>
+ <entry>
+ <function>include_once</function>
+ </entry>
+ <entry>
+ <function>isset</function>
+ </entry>
+ <entry>
+ <function>list</function>
+ </entry>
+ <entry>
+ <link linkend="keyword.class">new</link>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <function>print</function>
+ </entry>
+ <entry>
+ <function>require</function>
+ </entry>
+ <entry>
+ <function>require_once</function>
+ </entry>
+ <entry>
+ <function>return</function>
+ </entry>
+ <entry>
+ <link linkend="language.variables.scope">static</link>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <link linkend="control-structures.switch">switch</link>
+ </entry>
+ <entry>
+ <function>unset</function>
+ </entry>
+ <entry>
+ use
+ </entry>
+ <entry>
+ <link linkend="keyword.class">var</link>
+ </entry>
+ <entry>
+ <link linkend="control-structures.while">while</link>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <link linkend="language.constants.predefined">__FUNCTION__</link>
+ </entry>
+ <entry>
+ <link linkend="language.constants.predefined">__CLASS__</link>
+ </entry>
+ <entry>
+ <link linkend="language.constants.predefined">__METHOD__</link>
+ </entry>
+ <entry>
+ <link linkend="language.oop5.final">final</link> (PHP 5)
+ </entry>
+ <entry>
+ <link linkend="reserved.classes.php5">php_user_filter</link> (PHP 5)
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <link linkend="language.oop5.interfaces">interface</link> (PHP 5)
+ </entry>
+ <entry>
+ <link linkend="language.oop5.interfaces">implements</link> (PHP 5)
+ </entry>
+ <entry>
+ <link linkend="language.oop5.basic">extends</link>
+ </entry>
+ <entry>
+ <link linkend="language.oop5.visibility">public</link> (PHP 5)
+ </entry>
+ <entry>
+ <link linkend="language.oop5.visibility">private</link> (PHP 5)
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <link linkend="language.oop5.visibility">protected</link> (PHP 5)
+ </entry>
+ <entry>
+ <link linkend="language.oop5.abstract">abstract</link> (PHP 5)
+ </entry>
+ <entry>
+ <link linkend="language.oop5.cloning">clone</link> (PHP 5)
+ </entry>
+ <entry>
+ <link linkend="language.exceptions">try</link> (PHP 5)
+ </entry>
+ <entry>
+ <link linkend="language.exceptions">catch</link> (PHP 5)
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <link linkend="language.exceptions">throw</link> (PHP 5)
+ </entry>
+ <entry>
+ cfunction (PHP 4 only)
+ </entry>
+ <entry>
+ <link linkend="keyword.class">this</link> (PHP 5 only)
+ </entry>
+ <entry>
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ </sect1>
+
+ <sect1 xml:id="reserved.classes">
+ <title>预定义类</title>
+ <para>
+ 本节列出标准的预定义类。各种扩展库定义了其它类,其说明在各自的参考文档
中。
+ </para>
+
+ <sect2 xml:id="reserved.classes.standard">
+ <title>标准类</title>
+
+ <simpara>
+ 这些类由一些内建在 PHP 中的标准函数定义。
+ </simpara>
+
+ <variablelist>
+ <varlistentry>
+ <term><classname>Directory</classname></term>
+ <listitem>
+ <simpara>
+ 由<function>dir</function>创建.
+ </simpara>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><classname>stdClass</classname></term>
+ <listitem>
+ <simpara>
+ </simpara>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><classname>__PHP_Incomplete_Class</classname></term>
+ <listitem>
+ <simpara>
+ </simpara>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </sect2>
+
+ <sect2 xml:id="reserved.classes.php5">
+ <title>自 PHP 5 起预定义的类</title>
+
+ <simpara>
+ 这些额外的预定义类是 PHP 5.0.0 引进的。
+ </simpara>
+
+ <variablelist>
+ <varlistentry>
+ <term><classname>exception</classname></term>
+ <listitem>
+ <simpara>
+ </simpara>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><classname>php_user_filter</classname></term>
+ <listitem>
+ <simpara>
+ </simpara>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </sect2>
+
+ <sect2 xml:id="reserved.classes.closure">
+ <title>Closure</title>
+
+ <simpara>
+ PHP5.3.0中引入了一个预定义的final类<classname>Closure</classname>,它
可以用于实现
+<link linkend="functions.anonymous">匿名函数</link>
+ </simpara>
+ <simpara>
+ 该类的构造方法禁止手工创建该类的对象(会导致一个
<constant>E_RECOVERABLE_ERROR</constant>错误)。该类也有一个
<literal>__invoke</literal>
+ 方法来进行<link linkend="language.oop5.magic.invoke">魔术调用</link>。
+ </simpara>
+
+ </sect2>
+
+
+ <sect2 xml:id="reserved.classes.special">
+ <title>特殊的类</title>
+
+ <simpara>
+ 以下标记符不可以作为类名,因为它们有着特殊的用途。
+ </simpara>
+
+ <variablelist>
+ <varlistentry>
+ <term><classname>self</classname></term>
+ <listitem>
+ <simpara>
+ </simpara>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><classname>parent</classname></term>
+ <listitem>
+ <simpara>
+ </simpara>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </sect2>
+
+ </sect1>
+
+ &appendices.reserved.constants;
+
+</appendix>
+
+<!-- Keep this comment at the end of the file
+Local variables:
+mode: sgml
+sgml-omittag:t
+sgml-shorttag:t
+sgml-minimize-attributes:nil
+sgml-always-quote-attributes:t
+sgml-indent-step:1
+sgml-indent-data:t
+indent-tabs-mode:nil
+sgml-parent-document:nil
+sgml-default-dtd-file:"~/.phpdoc/manual.ced"
+sgml-exposed-tags:nil
+sgml-local-catalogs:nil
+sgml-local-ecat-files:nil
+End:
+vim600: syn=xml fen fdm=syntax fdl=2 si
+vim: et tw=78 syn=sgml
+vi: ts=1 sw=1
+-->
=======================================
--- /dev/null
+++ /trunk/xml/chapters/intro.xml Mon Apr 9 09:11:24 2012
@@ -0,0 +1,216 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- $Revision: 324974 $ -->
+<!-- EN-Revision: 306611 Maintainer: HonestQiao Status: ready -->
+<!-- Reviewed: no Maintainer: HonestQiao -->
+<!-- CREDITS: gregory -->
+ <chapter xml:id="introduction" xmlns="http://docbook.org/ns/docbook"
xmlns:xlink="http://www.w3.org/1999/xlink">
+ <title>简介</title>
+
+ <sect1 xml:id="intro-whatis">
+ <title>PHP 是什么?</title>
+ <para>
+ <acronym>PHP</acronym>("PHP: Hypertext
+ Preprocessor",超文本预处理器的字母缩写)是一种被广泛应用的开放源代码的
多用途脚本语言,它可嵌入到
+ HTML中,尤其适合 web 开发。
+ </para>
+ <para>
+ 以上是一个简单的回答,不过这是什么意思呢?请看如下例子:
+ </para>
+ <para>
+ <example>
+ <title>一个介绍性的范例</title>
+ <programlisting role="php">
+<![CDATA[
+<html>
+ <head>
+ <title>Example</title>
+ </head>
+ <body>
+
+ <?php
+ echo "Hi, I'm a PHP script!";
+ ?>
+
+ </body>
+</html>
+]]>
+ </programlisting>
+ </example>
+ </para>
+ <para>
+ 请注意这个范例和其它用 C 或 Perl
+ 语言写的脚本之间的区别----与用大量的命令来编写程序以输出 HTML
+ 不同的是,我们用 PHP 编写了一个 HTML
+ 脚本,其中嵌入了一些代码来做一些事情(例如,在本例中输出了一些文本)。
PHP
+ 代码被包含在特殊的<link
+ linkend="language.basic-syntax.phpmode">起始符和结束符</link>中,使得可
以进出"PHP 模式"。
+ </para>
+ <para>
+ 和客户端的 JavaScript 不同的是,PHP
+ 代码是运行在服务端的。如果在服务器上建立了如上例类似的代码,则在运行该
脚本后,客户端就能接收到其结果,但他们无法得知其背后的代码是如何运作的。甚至
可以将
+ web 服务器设置成让 PHP 来处理所有的 HTML 文件,这么一来,用户就无法得知
服务端到底做了什么。
+ </para>
+ <para>
+ 使用 PHP 的一大好处是它对于初学者来说极其简单,同时也给专业的程序员提供
了各种高级的特性。当看到
+ PHP 长长的特性列表时,请不要害怕。可以很快的入门,只需几个小时就可以自
己写一些简单的脚本。
+ </para>
+ <para>
+ 尽管 PHP
+ 的开发是以服务端脚本为目的,但事实上其功能远不局限与此。请继续读后面的
章节,在"<link
+ linkend="intro-whatcando">PHP 能做什么</link>"一节中将获得更多的信息。
如果对
+ web 编程感兴趣,也可以阅读<link linkend="tutorial">简明教程</link>。
+ </para>
+ </sect1>
+
+ <sect1 xml:id="intro-whatcando">
+ <title>PHP 能做什么?</title>
+ <para>
+ PHP 能做任何事。PHP 主要是用于服务端的脚本程序,因此可以用
+ PHP 来完成任何其它的 CGI
+ 程序能够完成的工作,例如收集表单数据,生成动态网页,或者发送/接收
+ Cookies。但 PHP 的功能远不局限于此。
+ </para>
+ <para>
+ PHP 脚本主要用于以下三个领域:
+ <itemizedlist>
+ <listitem>
+ <simpara>
+ 服务端脚本。这是 PHP
+ 最传统,也是最主要的目标领域。开展这项工作需要具备以下三点:PHP
+ 解析器(CGI 或者服务器模块)、web
+ 服务器和 web 浏览器。需要在运行 web 服务器时,安装并配置
+ PHP,然后,可以用 web 浏览器来访问 PHP 程序的输出,即浏览服务端的
+ PHP 页面。如果只是实验 PHP 编程,所有的这些都可以运行在自己家里的电
脑中。请查阅<link
+ linkend="install">安装</link>一章以获取更多信息。
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ 命令行脚本。可以编写一段 PHP
+ 脚本,并且不需要任何服务器或者浏览器来运行它。通过这种方式,仅仅只需

+ PHP 解析器来执行。这种用法对于依赖
+ cron(Unix 或者 Linux 环境)或者 Task Scheduler(Windows
+ 环境)的日常运行的脚本来说是理想的选择。这些脚本也可以用来处理简单的
文本。请参阅 <link
+ linkend="features.commandline">PHP 的命令行模式</link>以获取更多信
息。
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ 编写桌面应用程序。对于有着图形界面的桌面应用程序来说,PHP
+ 或许不是一种最好的语言,但是如果用户非常精通
+ PHP,并且希望在客户端应用程序中使用 PHP
+ 的一些高级特性,可以利用 PHP-GTK
+ 来编写这些程序。用这种方法,还可以编写跨平台的应用程序。PHP-GTK
+ 是 PHP 的一个扩展,在通常发布的 PHP 包中并不包含它。如果对 PHP-GTK
+ 感兴趣,请访问其<link xlink:href="&url.php.gtk;">网站</link>以获取更
多信息。
+ </simpara>
+ </listitem>
+ </itemizedlist>
+ </para>
+ <para>
+ PHP 能够用在所有的主流操作系统上,包括 Linux、Unix
+ 的各种变种(包括 HP-UX、Solaris 和 OpenBSD)、Microsoft
+ Windows、Mac OS X、RISC OS 等。今天,PHP已经支持了大多数的 web
+ 服务器,包括 Apache、Microsoft Internet Information
+ Server(IIS)、Personal web Server(PWS)、Netscape 以及
+ iPlant server、Oreilly Website Pro Server、Caudium、Xitami、OmniHTTPd
+ 等。对于大多数的服务器,PHP 提供了一个模块;还有一些
+ PHP 支持 CGI 标准,使得 PHP 能够作为 CGI 处理器来工作。
+ </para>
+ <para>
+ 综上所述,使用 PHP,可以自由地选择操作系统和 web
+ 服务器。同时,还可以在开发时选择使用面对过程和面对对象,或者两者混和的
方式来开发。尽管
+ PHP 4 不支持 OOP 所有的标准,但很多代码仓库和大型的应用程序(包括
+ PEAR 库)仅使用 OOP 代码来开发。PHP 5 弥补了 PHP 4 的这一弱点,引入了完
全的对象模型。
+ </para>
+ <para>
+ 使用 PHP,并不局限于输出 HTML。PHP
+ 还能被用来动态输出图像、PDF 文件甚至 Flash 动画(使用 libswf 和
+ Ming)。还能够非常简便的输出文本,例如 XHTML
+ 以及任何其它形式的 XML 文件。PHP
+ 能够自动生成这些文件,在服务端开辟出一块动态内容的缓存,可以直接把它们
打印出来,或者将它们存储到文件系统中。
+ </para>
+ <para>
+ PHP 最强大最显著的特性之一,是它支持很大范围的数据库。用户会发现利用
PHP
+ 编写数据库支持的网页简单得难以置信。目前,PHP 支持如下数据库:
+ <blockquote>
+ <simplelist columns="3">
+ <member>Adabas D</member>
+ <member>dBase</member>
+ <member>Empress</member>
+ <member>FilePro(只读)</member>
+ <member>Hyperwave</member>
+ <member>IBM DB2</member>
+ <member>Informix</member>
+ <member>Ingres</member>
+ <member>InterBase</member>
+ <member>FrontBase</member>
+ <member>mSQL</member>
+ <member>Direct MS-SQL</member>
+ <member>MySQL</member>
+ <member>ODBC</member>
+ <member>Oracle(OCI7 和 OCI8)</member>
+ <member>Ovrimos</member>
+ <member>PostgreSQL</member>
+ <member>SQLite</member>
+ <member>Solid</member>
+ <member>Sybase</member>
+ <member>Velocis</member>
+ <member>Unix dbm</member>
+ </simplelist>
+ </blockquote>
+ 同时还有一个叫做 PDO
+ 的数据库抽象扩展库使得可以自由地使用该扩展库支持的任何数据库。另外,PHP
+ 还支持 ODBC,即 Open Database Connection
+ Standard(开放数据库连接标准),因此可以连接任何其它支持该世界标准的数
据库。
+ </para>
+ <para>
+ PHP 还支持利用诸如 LDAP、IMAP、SNMP、NNTP、POP3、HTTP、COM(Windows
+ 环境)等不计其数的协议的服务。还可以开放原始网络端口,使得任何其它的协
议能够协同工作。PHP
+ 支持和所有 web 开发语言之间的 WDDX
+ 复杂数据交换。关于相互连接,PHP 已经支持了对 Java
+ 对象的即时连接,并且可以将他们自由的用作 PHP 对象。甚至可以用我们的
+ CORBA 扩展库来访问远程对象。
+ </para>
+ <para>
+ PHP 具有极其有效的文本处理特性,支持从 POSIX 扩展或者 Perl
+ 正则表达式到 XML 文档解析。为了解析和访问 XML
+ 文档,PHP 4 支持 SAX 和 DOM 标准,也可以使用
+ XSLT 扩展库来转换 XML 文档。PHP 5 基于强健的 libxm2 标准化了所有的
+ XML 扩展,并添加了 SimpleXML 和 XMLReader 支持,扩展了其在 XML 方面的功
能。
+ </para>
+ <para>
+ 另外,还有很多其它有趣的扩展库,他们根据<link linkend="extensions">字母
</link>和 <link linkend="funcref">分类</link>归类列出。例如 mnoGoSearch
+ 搜索引擎函数、IRC 网关函数、多种压缩工具(gzip、bz2、zip)、日历转换、
翻译......。
+ 还有一些第三方的PECL扩展没有在PHP手册中列出,例如 <link
xlink:href="&url.xdebug;">XDebug</link>
+ </para>
+ <para>
+ 由于在这里无法列出 PHP
+ 所有的特性和可提供的便利,请参阅<link
+ linkend="install">安装</link>以及<link
+ linkend="funcref">函数参考</link>有关章节以获取关于这里提到的扩展库更多
的信息。
+ </para>
+ </sect1>
+
+ </chapter>
+
+<!-- Keep this comment at the end of the file
+Local variables:
+mode: sgml
+sgml-omittag:t
+sgml-shorttag:t
+sgml-minimize-attributes:nil
+sgml-always-quote-attributes:t
+sgml-indent-step:1
+sgml-indent-data:t
+indent-tabs-mode:nil
+sgml-parent-document:nil
+sgml-default-dtd-file:"~/.phpdoc/manual.ced"
+sgml-exposed-tags:nil
+sgml-local-catalogs:nil
+sgml-local-ecat-files:nil
+End:
+vim600: syn=xml fen fdm=syntax fdl=2 si
+vim: et tw=78 syn=sgml
+vi: ts=1 sw=1
+-->
=======================================
--- /dev/null
+++ /trunk/xml/chapters/tutorial.xml Mon Apr 9 09:11:24 2012
@@ -0,0 +1,475 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- $Revision: 324974 $ -->
+<!-- EN-Revision: 324522 Maintainer: HonestQiao Status: ready -->
+<!-- Reviewed: no Maintainer: HonestQiao -->
+<!-- CREDITS: gregory -->
+<chapter xml:id="tutorial" xmlns="http://docbook.org/ns/docbook"
xmlns:xlink="http://www.w3.org/1999/xlink">
+ <title>简明教程</title>
+
+ <para>
+ 本章将给出关于 PHP 的简明教程。虽然 PHP 的功能并不局限于生成动态的 web
+ 页面,但本章的内容仅涉及于此。请查阅"<link linkend="intro-whatcando">PHP
+ 能做什么</link>"一节以获取更多信息。
+ </para>
+ <para>
+ 使用了 PHP 的 web 页面将被和通常的 HTML 页面一样处理,可以用通常建立 HTML
+ 页面的方法来建立和编辑它们。
+ </para>
+
+ <sect1 xml:id="tutorial.requirements">
+ <title>需要些什么?</title>
+ <para>
+ 在本教程中,假设用户的服务器已经安装并运行了 PHP,所有以
+ <filename>.php</filename> 结尾的文件都将由 PHP 来处理。在大部分的服务器
上,这是
+ PHP 的默认扩展名,不过,也请询问服务器管理员以确认。如果服务器支持
+ PHP,则不需要做任何事情。只用建立 <filename>.php</filename>
+ 文件,并把它们放置到 web
+ 目录中,服务器将神奇地自动解析这些文件。不用编译任何东西,也不用安装任何
其它的工具,仅仅只需把这些使用了
+ PHP 的文件想象成简单的 HTML
+ 文件,其中只不过多了一种新的标识符,在这里可以做各种各样的事情。大多数的
+ web 主机都提供 PHP 的支持,如果你的主机不支持,可以访问 <link
+ xlink:href="&url.php.links;">PHP 相关链接</link>来查找支持 PHP 的 web 主
机。
+ </para>
+ <para>
+ 假设用户希望在本地机器开发以节约宝贵的带宽。在这种情况下,需要安装一个诸

+ <link xlink:href="&url.apache;">Apache</link> 的 web 服务器,当然还有
+ <link xlink:href="&url.php.downloads;">PHP</link>。可能还希望安装一个数
据库,例如
+ <link xlink:href="&url.mysql.docs;">MySQL</link>。
+ </para>
+ <para>
+ 可以一个个的安装它们或选择一个更简单的方法。可以参考本手册中
+ <link linkend="install">PHP 安装说明</link>的相关章节(假设已经配置好了
某个
+ web 服务器)。若在自己安装 PHP
+ 时出现了问题,建议在<link
+ xlink:href="&url.php.mailing-lists;">安装邮件列表</link>中询问。如果想使
用更简便的方法安装
+ PHP,那么可以考虑<link xlink:href="&url.installkits;">获取一个预先配置的
安装包</link>,用这个安装包,只用点击几下鼠标,就可以自动地安装所有这些系
统。在任何操作系统下建立有
+ PHP 支持的 web 服务器都十分简单,包括 MacOSX、Linux 和 Windiws。在 Linux
+ 下,会发现 <link xlink:href="&url.rpmfind;">rpmfind</link> 和
+ <link xlink:href="&url.rpmfind.pbone;">PBone</link> 能够在获取 RPM
+ 时提供帮助。也可以使用 <link xlink:href="&url.apt-get;">apt-get</link>
+ 搜索 Debian 的相关软件包。
+ </para>
+ </sect1>
+
+ <sect1 xml:id="tutorial.firstpage">
+ <title>第一个 PHP 页面</title>
+ <para>
+ 在 web 服务器根目录(<varname>DOCUMENT_ROOT</varname>)下建立一个文件名

+ <filename>hello.php</filename>,然后完成如下内容:
+ </para>
+ <para>
+ <example>
+ <title>第一个 PHP 脚本:<filename>hello.php</filename></title>
+ <programlisting role="php">
+<![CDATA[
+<html>
+ <head>
+ <title>PHP 测试</title>
+ </head>
+ <body>
+ <?php echo '<p>Hello World</p>'; ?>
+ </body>
+</html>
+]]>
+ </programlisting>
+ <simpara>
+ 在浏览器的地址栏里输入 web 服务器的 URL
+ 访问这个文件,在结尾加上"/hello.php"。如果本地开发,那么这个
+ URL 一般是 <literal>http://localhost/hello.php</literal> 或者
+ <literal>http://127.0.0.1/hello.php</literal>,当然这取决于
+ web 服务器的设置。如果所有的设置都正确,那么这个文件将被
+ PHP 解析,浏览器中将会输出如下结果:
+ </simpara>
+ <screen role="html">
+<![CDATA[
+<html>
+ <head>
+ <title>PHP 测试</title>
+ </head>
+ <body>
+ <p>Hello World</p>
+ </body>
+</html>
+]]>
+ </screen>
+ </example>
+ </para>
+ <para>
+ 该程序非常的简单,它仅仅只是利用了 PHP 的 <function>echo</function> 语句
显示了
+ <literal>Hello World</literal>。用户一定不会满足与此。请注意该文件
<emphasis>无需被执行</emphasis>或以任何方式指定。服务器会找到该文件并提供给
+ PHP 进行解释,因为使用了".php"的扩展名,服务器已被配置成自动传递有着
".php"扩展名的文件给
+ PHP。一个普通的 HTML 文件,加上了几个特别的标签,就可以做很多非常有趣的
事情!
+ </para>
+ <para>
+ 如果试过了这个例子,但是没有得到任何输出,或者浏览器弹出了下载框,或者浏
览器以文本方式显示了源文件,可能的原因是服务器还没有支持
+ PHP,或者没有正确配置。需要请服务器的管理员根据本手册"<link
linkend="install">安装</link>"一章的内容使得服务器支持
+ PHP。如果本地开发,请阅读手册有关安装的章节以确保所有的设置都正确。还要
确认通过浏览器访问的
+ URL 确实指向了服务器上的这个文件。如果只是从本地文件系统调用这个文件,它
不会被
+ PHP 解析。如果问题仍然存在,请通过 <link
xlink:href="&url.php.support;">PHP
+ 在线支持</link>中的各种方式获取帮助。
+ </para>
+ <para>
+ 以上例子的目的是为了显示 PHP 特殊标识符的格式。在这个例子中,用
+ <literal>&lt;?php</literal> 来表示 PHP 标识符的起始,然后放入
+ PHP 语句并通过加上一个终止标识符 <literal>?&gt;</literal> 来退出
+ PHP 模式。可以根据自己的需要在 HTML 文件中像这样开启或关闭
+ PHP 模式。请参阅手册中"<link linkend="language.basic-syntax">PHP 基本语
法</link>"以获取更多信息。
+ </para>
+
+ <note>
+ <title>关于换行</title>
+ <para>
+ 尽管换行在 HTML 中的实际意义不是很大,但适当地使用换行可以使 HTML
+ 代码易读且美观。PHP 会在输出时自动删除其结束符 <literal>?&gt;</literal>
+ 后的一个换行。该功能主要是针对在一个页面中嵌入多段 PHP
+ 代码或者包含了无实质性输出的 PHP 文件而设计,与此同时也造成了一些疑惑。
如果在
+ PHP 结束符 <literal>?&gt;</literal> 后输出换行的话,可以在其后加一个空
格,或者在最后的一个
+ echo/print 语句中加入一个换行。
+ </para>
+ </note>
+
+ <note>
+ <title>关于文本编辑器</title>
+ <para>
+ 有很多文本编辑器以及集成开发环境(IDE)可以被用来建立、编辑和管理
+ PHP 文件。这些工具中的一部分被列在 <link
+ xlink:href="&url.phpeditorlist;">PHP 编辑器列表</link>中。如果希望推荐
其它的编辑器,请访问以上页面,并要求该页面的维护者将你推荐的编辑器加入到该列
表中。使用支持语法高亮功能的编辑器会给开发带来很多帮助。
+ </para>
+ </note>
+
+ <note>
+ <title>关于文字处理器</title>
+ <para>
+ 诸如 StarOffice Writer、Microsoft Word 和 Abiword
+ 的文字处理器不适合用来编辑 PHP
+ 程序。如果希望用以上这些工具的某一种来处理脚本,必须保证将结果存成了
<emphasis>纯文本</emphasis>格式,否则
+ PHP 将无法读取并运行这些脚本。
+ </para>
+ </note>
+
+ <note>
+ <title>关于 Windows 记事本</title>
+ <para>
+ 如果使用 Windows 记事本来编写 PHP
+ 脚本,需要注意在保存文件时,文件的后缀名应该为
+ .php(记事本将自动在文件名后面加上 .txt
+ 后缀,除非采取以下措施之一来避免这种情况)。当保存文件时,系统会让你指
定文件的文件名,这时请将文件名加上引号(例如
<filename>"hello.php"</filename>)。或者,也可以点击"保存"对话框中的"保存类
型"下拉菜单,并将设置改为"所有文件"。这样在输入文件名的时候就不用加引号了。
+ </para>
+ </note>
+ <para>
+ 现在已经成功建立了一个简单的 PHP 脚本。还可以建立一个最著名的
+ PHP 脚本。调用函数 <function>phpinfo</function>,将会看到很多有关自己系
统有用的信息,以及<link
+ linkend="language.variables.predefined">预定义变量</link>、已经加载的
+ PHP 模块和<link linkend="configuration">配置</link>信息。请花一些时间来
查看这些重要的信息。
+ </para>
+ <para>
+ <example>
+ <title>从 PHP 获取系统信息</title>
+ <programlisting role="php">
+<![CDATA[
+<?php phpinfo(); ?>
+]]>
+ </programlisting>
+ </example>
+ </para>
+ </sect1>
+
+ <sect1 xml:id="tutorial.useful">
+ <title>实用的脚本</title>
+ <para>
+ 现在来编写一些更实用的脚本,比如检查浏览页面的访问者在用什么浏览器。要达
到这个目的,需要检查用户的
+ agent 字符串,它是浏览器发送的 HTTP 请求的一部分。该信息被存储在一个
<link
+ linkend="language.variables">变量</link>中。在 PHP
+ 中,变量总是以一个美元符开头。我们现在感兴趣的变量是
+ <varname>$_SERVER['HTTP_USER_AGENT']</varname>。
+ </para>
+ <note>
+ <para>
+ <link linkend="reserved.variables.server">$_SERVER</link>
+ 是一个特殊的 PHP 保留变量,它包含了 web
+ 服务器提供的所有信息,被称为超全局变量。请查阅本手册"<link
+ linkend="language.variables.superglobals">超全局变量</link>"中的有关内
容以获取更多信息。这些特殊的变量是在
+ PHP <link xlink:href="&url.php.release4.1.0;">4.1.0</link> 版本引入的。
在这之前使用
+ <varname>$HTTP_*_VARS</varname> 数组,如
+ <varname>$HTTP_SERVER_VARS</varname>。尽管现在已经不用了,但它们在新版
本中仍然存在(参见"<link
+ linkend="tutorial.oldcode">旧代码</link>"一节中的注解)。
+ </para>
+ </note>
+ <para>
+ 要显示该变量,只需简单地进行如下操作:
+ </para>
+ <para>
+ <example>
+ <title>打印一个变量(数组元素)</title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+echo $_SERVER['HTTP_USER_AGENT'];
+?>
+]]>
+ </programlisting>
+ <para>
+ 该脚本的输出可能是:
+ </para>
+ <screen role="html">
+Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)
+ </screen>
+ </example>
+ </para>
+ <para>
+ PHP 有很多种不同<link
+ linkend="language.types">类型</link>的变量。在以上例子中我们打印了一个
<link
+ linkend="language.types.array">数组</link>的单元。数组是一类非常有用的变
量。
+ </para>
+ <para>
+ <varname>$_SERVER</varname> 只是 PHP 自动全局化的变量之一。可以查阅
"<link
+ linkend="reserved.variables">保留变量</link>"一节来查看这些变量的列
表,或者也可以通过上节例子中
+ <function>phpinfo</function> 函数的输出来查看。
+ </para>
+ <para>
+ 可以在一个 PHP 标识中加入多个 PHP 语句,也可以建立一个代码块来做比简单的
+ echo 更多的事情。例如,如果需要识别 Internet Explorer,可以进行如下操
作:
+ </para>
+ <para>
+ <example>
+ <title><link linkend="language.control-structures">流程控制</link>与
<link linkend="language.functions">函数</link>的使用</title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== FALSE) {
+ echo '正在使用 Internet Explorer。<br />';
+}
+?>
+]]>
+ </programlisting>
+ <para>
+ 该脚本的输出可能是:
+ </para>
+ <screen role="html">
+<![CDATA[
+正在使用 Internet Explorer。<br />
+]]>
+ </screen>
+ </example>
+ </para>
+ <para>
+ 这里要介绍一些新的原理。上面用了一个
+ <link linkend="control-structures.if">if</link> 语句。如果用户对
+ C 语言的基本语法比较熟悉,则应该对此很熟悉,否则,可能需要拿起任何一本
+ PHP 介绍性的书籍并阅读前面的两三个章节,或者也可以阅读本手册的"<link
+ linkend="langref">语言参考</link>"一章。
+ </para>
+ <para>
+ 需要介绍的第二个原理,是对 <function>strpos</function>
+ 函数的调用。<function>strpos</function> 是 PHP
+ 的一个内置函数,其功能是在一个字符串中搜索另外一个字符串。例如我们现在需
要在
+ <varname>$_SERVER['HTTP_USER_AGENT']</varname>(即所谓的 haystack)变量
中寻找
+ <literal>'MSIE'</literal>。如果在这个 haystack
+ 中该字符串(即所谓的 needle)被找到,则函数返回 needle
+ 在 haystack 中相对开头的位置;如果没有,则返回 &false;。如果该函数没有返

+ &false;,则 <link linkend="control-structures.if">if</link> 会将条件判断

+ &true; 并运行其花括号 {} 内的代码;否则,则不运行这些代码。可以自己尝试
利用
+ <link linkend="control-structures.if">if</link>,<link
+ linkend="control-structures.else">else</link> 以及其它的函数,例如
+ <function>strtoupper</function> 和
+ <function>strlen</function>,来建立类似的脚本。在本手册中相关的页面也包
含有范例。如果对如何使用函数不是很确定,可以阅读手册中有关"<link
+ linkend="about.prototypes">如何阅读函数定义</link>"和"<link
+ linkend="language.functions">函数</link>"的有关章节。
+ </para>
+ <para>
+ 以下我们进一步显示如何进出 PHP 模式,甚至是在一个 PHP 代码块的中间:
+ </para>
+ <para>
+ <example>
+ <title>混和 HTML 和 PHP 模式</title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== FALSE) {
+?>
+<h3>strpos() 肯定没有返回假 (FALSE)</h3>
+<p>正在使用 Internet Explorer</p>
+<?php
+} else {
+?>
+<h3>strpos() 肯定返回假 (FALSE)</h3>
+<center><b>没有使用 Internet Explorer</b></center>
+<?php
+}
+?>
+]]>
+ </programlisting>
+ <para>
+ 该脚本的输出可能是:
+ </para>
+ <screen role="html">
+<![CDATA[
+<h3>strpos() 肯定没有返回假 (FALSE)</h3>
+<p>正在使用 Internet Explorer</p>
+]]>
+ </screen>
+ </example>
+ </para>
+ <para>
+ 和以上我们用一个 PHP 的 echo 语句来输出不同的是,我们跳出了
+ PHP 模式来直接写 HTML
+ 代码。这里很值得注意的一点是,对于这两种情况而言,脚本的逻辑效率是相同
的。在判断了
+ <function>strpos</function> 函数的返回值是 &true; 或是
+ &false;,也就是判断了字符串 <literal>'MSIE'</literal>
+ 是否被找到之后,最终只有一个 HTML 块被发送给浏览者。
+ </para>
+ </sect1>
+
+ <sect1 xml:id="tutorial.forms">
+ <title>处理表单</title>
+ <para>
+ PHP 一个很有用的特点体现在它处理 PHP
+ 表单的方式。需要理解的非常重要的原理,是表单的任何元素都在
+ PHP 脚本中自动生效。请参阅本手册中"<link
+ linkend="language.variables.external">PHP 的外部变量</link>"以获取关于在
+ PHP 中使用表单的详细信息及范例。以下是 HTML 表单的范例:
+ </para>
+ <para>
+ <example>
+ <title>一个简单的 HTML 表单</title>
+ <programlisting role="html">
+<![CDATA[
+<form action="action.php" method="post">
+ <p>姓名: <input type="text" name="name" /></p>
+ <p>年龄: <input type="text" name="age" /></p>
+ <p><input type="submit" /></p>
+</form>
+]]>
+ </programlisting>
+ </example>
+ </para>
+ <para>
+ 该表单中并没有什么特殊的地方,其中没有使用任何特殊的标识符。当用户填写了
该表单并点击了提交按钮,页面
+ <filename>action.php</filename> 将被调用。在该文件中,可以加入如下内容:
+ </para>
+ <para>
+ <example>
+ <title>打印来自表单的数据</title>
+ <programlisting role="php">
+<![CDATA[
+你好,<?php echo htmlspecialchars($_POST['name']); ?>。
+你 <?php echo (int)$_POST['age']; ?> 岁了。
+]]>
+ </programlisting>
+ <para>
+ 该脚本的输出可能是:
+ </para>
+ <screen role="html">
+<![CDATA[
+你好,Joe。你 22 岁了。
+]]>
+ </screen>
+ </example>
+ </para>
+ <para>
+ 除了<function>htmlspecialchars</function> 和
+ <literal>(int)</literal> 部分,这么做是显而易见的。
+ <function>htmlspecialchars</function> 使得 HTML 之中的特殊字符被正确
的编码,从而不会被使用者在页面注入 HTML 标签或者 Javascript代码。例如 age 字
段,我们明确知道他是一个数值,因此我们将它<link
+ linkend="language.types.typecasting">转换</link>
+ 为一个 <type>整形值(integer)</type> 来自动的消除任何不必要的字符。你
也可以使用PHP的 <link linkend="ref.filter">过滤(filter)</link> 扩来自动的完
成该工作。
+ PHP
+ 将自动设置 <varname>$_POST['name']</varname> 和
+ <varname>$_POST['age']</varname> 变量。在这之前我们使用了超全局变量
+ <varname>$_SERVER</varname>,现在我们引入了超全局变量
+ <link linkend="reserved.variables.post">$_POST</link>,它包含了所有的
+ POST 数据。请注意我们的表单提交数据的<emphasis>方法
</emphasis>(method)。如果使用了
+ <emphasis>GET</emphasis> 方法,那么表单中的信息将被储存到超全局变量
+ <link linkend="reserved.variables.get">$_GET</link>
+ 中。如果并不关心请求数据的来源,也可以用超全局变量
+ <link linkend="reserved.variables.request">$_REQUEST</link>,它包含了所

+ GET、POST、COOKIE 和 FILE 的数据。请参阅
+ <function>import_request_variables</function> 函数。
+ </para>
+ <para>
+ 也可以在 PHP 中处理 XForms 的输入,尽管可能更喜欢使用长久以来支持良好的
+ HTML 表单。XForms
+ 目前还不适合初学者使用,但是用户可能对它感兴趣。手册中在"特点"一章有一节
对如何<link
+ linkend="features.xforms">处理从 XForum 接收到的数据</link>进行了简短的
介绍。
+ </para>
+ </sect1>
+
+ <sect1 xml:id="tutorial.oldcode">
+ <title>在新版本的 PHP 中使用旧的 PHP 代码</title>
+ <para>
+ 现在,PHP 已经发展成为一种流行的脚本语言,可以在很多公共的资源里找到可以
在自己的脚本中重新利用的代码。PHP
+ 语言的开发者为向下兼容性下了很多功夫,因此在新版本的
+ PHP 下,老版本的代码应该可以在不作任何改动的情况下(理想地)运行。不过实
际上,还是必须对老的代码做一些改动。
+ </para>
+ <para>
+ 有可能影响到老版本的代码的最重要的两点改动分别是:
+ <itemizedlist>
+ <listitem>
+ <simpara>
+ 取消了旧的 <varname>$HTTP_*_VARS</varname>
+ 数组(在函数或者方法中原本是全局变量)。PHP
+ <link xlink:href="&url.php.release4.1.0;">4.1.0</link>
+ 版本引入了如下<link
+ linkend="language.variables.superglobals">超全局数组变量
</link>:<varname>$_GET</varname>、<varname>$_POST</varname>、
<varname>$_COOKIE</varname>、<varname>$_SERVER</varname>、
<varname>$_FILE</varname>、<varname>$_ENV</varname>、
<varname>$_REQUEST</varname>
+ 以及 <varname>$_SESSION</varname>。老的
<varname>$HTTP_*_VARS</varname>
+ 数组,诸如 $HTTP_POST_VARS 等,从 PHP 3 就已经开始使用,它们仍然存
在。&avail.register-long-arrays;
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ 外部变量不再被默认注册为全局变量。也就是说,从
+ PHP <link xlink:href="&url.php.release4.2.0;">4.2.0</link>
+ 版开始,&php.ini; 中的设置选项
+ <link linkend="ini.register-globals">register_globals</link>
+ 默认值变成了
+ <emphasis>off</emphasis>。建议用以上提到的超全局数组变量来访问这些
值。但可能老的脚本、书籍以及教程都可能建立在该设置为
+ on 的基础上。如果该选项被设置为
+ on,则可以在
+ URL <literal>http://www.example.com/foo.php?id=42</literal>
+ 中直接使用变量 <varname>$id</varname>。但不管被设置为 on 还是
+ off,<varname>$_GET['id']</varname> 一直有效。
+ </simpara>
+ </listitem>
+ </itemizedlist>
+ </para>
+ <para>
+ 如果希望了解关于这些改动的细节,请参阅"<link
+ linkend="language.variables.predefined">预定义变量</link>"一章以及其中的
连接。
+ </para>
+ </sect1>
+
+ <sect1 xml:id="tutorial.whatsnext">
+ <title>下一步做什么?</title>
+ <para>
+ 用现在掌握的知识,应该能够理解本手册中的大部分内容以及其中各式各样的脚本
范例。在
+ php.net 网站的连接区
+ <link xlink:href="&url.php.links;">&url.php.links;</link> 能购获得其它更
多的范例。
+ </para>
+ <para>
+ 请查阅 PHP Conference 资料网站
+ <link xlink:href="&url.php.talks;">&url.php.talks;</link>
+ 以观看更多幻灯片,这些幻灯片展示了许多 PHP 其它的功能。
+ </para>
+ </sect1>
+</chapter>
+
+<!-- Keep this comment at the end of the file
+Local variables:
+mode: sgml
+sgml-omittag:t
+sgml-shorttag:t
+sgml-minimize-attributes:nil
+sgml-always-quote-attributes:t
+sgml-indent-step:1
+sgml-indent-data:t
+indent-tabs-mode:nil
+sgml-parent-document:nil
+sgml-default-dtd-file:"~/.phpdoc/manual.ced"
+sgml-exposed-tags:nil
+sgml-local-catalogs:nil
+sgml-local-ecat-files:nil
+End:
+vim600: syn=xml fen fdm=syntax fdl=2 si
+vim: et tw=78 syn=sgml
+vi: ts=1 sw=1
+-->
+
=======================================
--- /dev/null
+++ /trunk/xml/faq/general.xml Mon Apr 9 09:11:24 2012
@@ -0,0 +1,114 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- $Revision: 324974 $ -->
+<!-- EN-Revision: 297028 Maintainer: HonestQiao Status: ready -->
+<!-- Reviewed: no Maintainer: HonestQiao -->
+<!-- $EN-Revision: 297028 $ -->
+<chapter xml:id="faq.general"
+ xmlns="http://docbook.org/ns/docbook"
+ xmlns:xlink="http://www.w3.org/1999/xlink">
+ <title>一般信息</title>
+ <titleabbrev>一般信息</titleabbrev>
+ <para>本章包括了有关 PHP 的大多数一般问题:它是什么和它做什么。</para>
+ <qandaset>
+ <qandaentry xml:id="faq.general.what">
+ <question>
+ <para>PHP 是什么?</para>
+ </question>
+ <answer>
+ <para>根据本手册的
+ <link linkend="preface">前言</link>:</para>
+ <para>PHP 是一种 HTML 嵌入式的脚本语言。它的很多语法来自 C,Java
和 Perl,并具有几个 PHP 独有的特点。该语言的主要目标是让 Web 开发人员快速地
书写动态生成的网页。</para>
+ </answer>
+ </qandaentry>
+ <qandaentry xml:id="faq.general.acronym">
+ <question>
+ <para>PHP 这个缩写指的是什么?</para>
+ </question>
+ <answer>
+ <para>PHP 是
+ <emphasis>PHP: Hypertext Preprocessor</emphasis>的首字母缩写。很多
人有些糊涂了,因为缩写中的第一个字母也来自缩写。这种方法叫做递归缩写
(recursive acronyms),对此好奇的人可以访问
+ <link xlink:href="&url.foldoc;">在线计算机词典(Free On-Line
Dictionary of Computing)</link>或者Wikipedia上
+ <link xlink:href="&url.wiki.recursive-acronym;">递归缩写</link>的解
释。</para>
+ </answer>
+ </qandaentry>
+ <qandaentry xml:id="faq.general.relation-versions">
+ <question>
+ <para>PHP 版本之间有什么联系?</para>
+ </question>
+ <answer>
+ <para>PHP/FI 2.0 是最早的 PHP 版本,已经不再支持。PHP 3 是 PHP/FI
2.0 的后继者,要好很多。PHP 5 是目前一代的 PHP,内部使用了
+ <link xlink:href="&url.zend;">Zend 引擎 2 代</link>,除了很多新功能
之外还提供了许多附加的
+ <link linkend="language.oop5">面向对象编程(OOP)</link>特性。
</para>
+ </answer>
+ </qandaentry>
+ <qandaentry xml:id="faq.general.running-concurent">
+ <question>
+ <para>可以同时运行几个不同版本的 PHP 吗?</para>
+ </question>
+ <answer>
+ <para>可以,请参阅见 PHP 源程序发行包中的
+ <filename>INSTALL</filename>文件。</para>
+ </answer>
+ </qandaentry>
+ <qandaentry xml:id="faq.general.differences-45">
+ <question>
+ <para>PHP4 和 PHP5 有什么不同?</para>
+ </question>
+ <answer>
+ <para>PHP5可以向下兼容PHP4的程序,但PHP中有很多改进的地方。如下:
+ <itemizedlist>
+ <listitem>
+ <simpara>一个
+ <link linkend="language.oop5">新的面向对象模型</link>,基于
+ <emphasis>Zend Engine 2.0</emphasis></simpara>
+ </listitem>
+ <listitem>
+ <simpara>一个改进过的 MySQL 扩展</simpara>
+ </listitem>
+ <listitem>
+ <simpara>内置支持 SQLite</simpara>
+ </listitem>
+ <listitem>
+ <simpara>新的错误报告常量,
+ <link linkend="migrating5.errorrep">E_STRICT</link>, 用于生成执
行期的错误信息。</simpara>
+ </listitem>
+ <listitem>
+ <simpara>很多新的
+ <link linkend="migration5.functions">函数</link>来简化开发。
</simpara>
+ </listitem>
+ </itemizedlist>要获知更多详细信息,请查看
+ <link linkend="faq.migration5">从 PHP 4 升级到 PHP 5</link>及
+ <link linkend="migration5.incompatible">向下兼容的改进</link>。
</para>
+ </answer>
+ </qandaentry>
+ <qandaentry xml:id="faq.general.bug">
+ <question>
+ <para>我觉得自己发现了一个 bug!应该告诉谁?</para>
+ </question>
+ <answer>
+ <para>应该访问 PHP Bug 数据库并确认你发现的不是一个已知的 bug。如果
你在数据库中没有看到同样的,用报告表单来报告此 bug。使用 bug 数据库而不是给
某个邮件列表发邮件非常重要,因为该 bug 会被分配一个跟踪号码,这样你就有可能
在以后回来查看该 bug 的状态。Bug 数据库在
+ <link xlink:href="&url.php.bugs;">&url.php.bugs;</link>。</para>
+ </answer>
+ </qandaentry>
+ </qandaset>
+</chapter>
+<!-- Keep this comment at the end of the file
+Local variables:
+mode: sgml
+sgml-omittag:t
+sgml-shorttag:t
+sgml-minimize-attributes:nil
+sgml-always-quote-attributes:t
+sgml-indent-step:1
+sgml-indent-data:t
+indent-tabs-mode:nil
+sgml-parent-document:nil
+sgml-default-dtd-file:"~/.phpdoc/manual.ced"
+sgml-exposed-tags:nil
+sgml-local-catalogs:nil
+sgml-local-ecat-files:nil
+End:
+vim600: syn=xml fen fdm=syntax fdl=2 si
+vim: et tw=78 syn=sgml
+vi: ts=1 sw=1
+-->
=======================================
--- /dev/null
+++ /trunk/xml/faq/languages.xml Mon Apr 9 09:11:24 2012
@@ -0,0 +1,61 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- $Revision: 324974 $ -->
+<!-- EN-Revision: 300233 Maintainer: HonestQiao Status: ready -->
+<!-- Reviewed: no Maintainer: HonestQiao -->
+<!-- $EN-Revision: 300233 $ -->
+<chapter xml:id="faq.languages"
+ xmlns="http://docbook.org/ns/docbook"
+ xmlns:xlink="http://www.w3.org/1999/xlink">
+ <title>PHP 和其它语言</title>
+ <titleabbrev>PHP 和其它语言</titleabbrev>
+ <para>PHP 是 web 编程最好的语言,但其它语言怎样呢?</para>
+ <qandaset>
+ <qandaentry xml:id="faq.languages.asp">
+ <question>
+ <para>PHP 对 ASP?</para>
+ </question>
+ <answer>
+ <para>ASP 本身并不真的是一种语言,它是 Active Server Pages 的缩
写,实际上用来进行 ASP 编程的语言是 Visual Basic Script 或者 JScript。ASP 最
大的缺点是它是一个专有系统而只能在 Microsoft Internet Information
Server(IIS)上使用。这限制了它只能在基于 Win32 的服务器上使用。有几项进行中
的计划使 ASP 可以在其它环境和 web 服务器中使用:
+ <link xlink:href="&url.halcyon;">Halcyon</link>(商业的)的
+ <link xlink:href="&url.instantasp;">InstantASP</link>,
+ <link xlink:href="&url.chilisoft;">Chili!Soft</link>(商业的) 的
Chili!Soft ASP和<link xlink:href="&url.mono;">Mono</link> (open-source)。
ASP 被认为比 PHP 慢和麻烦,也不稳定。一些 ASP 的正面观点是既然它基本上用
VBScript,那如果你已经懂得用 Visual Basic 编程就会相对容易拾起这种语言。在
IIS 服务器中默认激活了 ASP 支持,这使它容易启动和运行。ASP 中内置的组件实在
是很有限,因此如果需要一些"高级的"特点例如与 FTP 服务器交互,需要购买额外的
组件。</para>
+ </answer>
+ </qandaentry>
+ <qandaentry xml:id="faq.languages.coldfusion">
+ <question>
+ <para>PHP 对 Cold Fusion?</para>
+ </question>
+ <answer>
+ <para>PHP 普遍被认为对复杂的编程任务更快和更有效以及勇于尝试新主
意。PHP 也通常被提及更稳定以及占用更少资源。Cold Fusion 具有更好的错误处
理,数据库抽象和数据解析,尽管数据库抽象已经在 PHP 4 中解决了。另外一个被作
为 Cold Fusion 的强项列出来的是它卓越的搜索引擎,但也被指出搜索引擎不是 web
脚本语言中应该包括的东西。PHP 可以在几乎每一个现有的平台下运行;Cold Fusion
只能在 Win32,Solaris,Linux 和 HP/UX 下运行。Cold Fusion 有很好的集成开发环
境以及通常更容易上手,反之 PHP 则一开头就需要更多的编程知识。Cold Fusion 是
为非程序员的头脑所设计,而 PHP 则聚焦于程序员。</para>
+ </answer>
+ </qandaentry>
+ <qandaentry xml:id="faq.languages.perl">
+ <question>
+ <para>PHP 对 Perl?</para>
+ </question>
+ <answer>
+ <para>PHP 对 Perl 最大的优势就是 PHP 是为 web 脚本设计的而 Perl 则
被设计用来做更多的事也因此而非常复杂。Perl 的灵活性/复杂性使得用它能很容易
写出代码但却让另一个作者/编程者非常难读懂。PHP 则不容易把人搞糊涂以及具有更
严谨的格式同时也不失灵活性。PHP 比 Perl 更容易集成进现有的 HTML 中去。PHP 具
有差不多所有 Perl 的"好"功能:结构,语法等等,但却没有使它达到 Perl 的费解程
度。Perl 是一种久经考验真正的语言,从上个世纪八十年代末起就到处都有,但是
PHP 成熟得非常快。</para>
+ </answer>
+ </qandaentry>
+ </qandaset>
+</chapter>
+<!-- Keep this comment at the end of the file
+Local variables:
+mode: sgml
+sgml-omittag:t
+sgml-shorttag:t
+sgml-minimize-attributes:nil
+sgml-always-quote-attributes:t
+sgml-indent-step:1
+sgml-indent-data:t
+indent-tabs-mode:nil
+sgml-parent-document:nil
+sgml-default-dtd-file:"~/.phpdoc/manual.ced"
+sgml-exposed-tags:nil
+sgml-local-catalogs:nil
+sgml-local-ecat-files:nil
+End:
+vim600: syn=xml fen fdm=syntax fdl=2 si
+vim: et tw=78 syn=sgml
+vi: ts=1 sw=1
+-->
=======================================
--- /dev/null
+++ /trunk/xml/faq/obtaining.xml Mon Apr 9 09:11:24 2012
@@ -0,0 +1,196 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- $Revision: 324974 $ -->
+<!-- EN-Revision: 322138 Maintainer: HonestQiao Status: ready -->
+<!-- Reviewed: no Maintainer: HonestQiao -->
+<!-- $EN-Revision: 304887 $ -->
+<chapter xml:id="faq.obtaining"
+ xmlns="http://docbook.org/ns/docbook"
+ xmlns:xlink="http://www.w3.org/1999/xlink">
+ <title>获取 PHP</title>
+ <titleabbrev>获取 PHP</titleabbrev>
+ <para>本章包括 PHP 下载地址以及操作系统相关问题的详细资料。</para>
+ <qandaset>
+ <qandaentry xml:id="faq.obtaining.where">
+ <question>
+ <para>PHP 可以从哪里得到?</para>
+ </question>
+ <answer>
+ <para>可以从任何一个 PHP 网络成员的站点下载 PHP。这些信息在
+ <link xlink:href="&url.php;">&url.php;</link>。还可以通过匿名 SVN
得到绝对是最新版的源程序。更多信息请访问
+ <link xlink:href="&url.php.anonsvn;">&url.php.anonsvn;</link>。
</para>
+ </answer>
+ </qandaentry>
+ <qandaentry xml:id="faq.obtaining.precompiled">
+ <question>
+ <para>有预先编译好的可执行版本吗?</para>
+ </question>
+ <answer>
+ <para>我们只为 Windows 系统提供了预编译的可执行文件,因为我们没法为
每个主流的 Linux/Unix 平台编译每一种扩展库组和的 PHP。同样注意,如今很多
Linux 的发行版本已经内置了 PHP。Windows 可执行文件可以从我们的
+ <link xlink:href="&url.php.downloads;">下载</link>页面下载,至于
Linux 可执行文件,请访问你的 Linux 发布商的站点。</para>
+ </answer>
+ </qandaentry>
+ <qandaentry xml:id="faq.obtaining.optional">
+ <question>
+ <para>编译一些可选的 PHP 扩展库所需的库文件可以从哪里得到?</para>
+ </question>
+ <answer>
+ <para>
+ <note>
+ <simpara>有 * 号标记的不是多线程的库,不应该用作多线程 Windows
web 服务器(IIS,Netscape)的服务器模块。不过这在 Unix 环境下没有关系。
+ <!-- thread - safe? 还没想出合适的词来 --></simpara>
+ </note>
+ </para>
+ <para>
+ <itemizedlist>
+ <listitem>
+ <simpara>
+ <link xlink:href="&url.ldap.openldap.source;">LDAP
(Unix)</link>
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ <link xlink:href="&url.ldap.netscape.sdk;">LDAP
(Unix/Win)</link>: Mozilla Directory (LDAP) SDK</simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ <link xlink:href="&url.ldap.bind9;">免费 LDAP 服务器</link>
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ <link xlink:href="&url.sleepycat;">Berkeley DB2
(Unix/Win)</link>: &url.sleepycat;.</simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ <link xlink:href="&url.net-snmp;">SNMP* (Unix):</link>
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ <link xlink:href="&url.gd;">GD* (Unix/Win)</link>
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ <link xlink:href="&url.msql;">mSQL* (Unix)</link>
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ <link xlink:href="&url.pgsql;">PostgreSQL (Unix)</link>
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ <link xlink:href="&url.imap;">IMAP* (Win/Unix)</link>
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ <link xlink:href="&url.sybase;">Sybase-CT* (Linux,
libc5)</link>:内置</simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ <link xlink:href="&url.freetype;">FreeType (libttf):</link>
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ <link xlink:href="&url.zlib;">ZLib (Unix/Win32)</link>
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ <link xlink:href="&url.expat;">expat XML parser
(Unix/Win32)</link>
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ <link xlink:href="&url.pdf;">PDFLib</link>
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ <link xlink:href="&url.mcrypt;">mcrypt</link>
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ <link xlink:href="&url.mhash;">mhash</link>
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ <link xlink:href="&url.t1lib;">t1lib</link>
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ <link xlink:href="&url.dmalloc;">dmalloc</link>
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ <link xlink:href="&url.aspell;">aspell</link>
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ <link xlink:href="&url.readline;">readline</link>
+ </simpara>
+ </listitem>
+ </itemizedlist>
+ </para>
+ </answer>
+ </qandaentry>
+ <qandaentry xml:id="faq.obtaining.how">
+ <question>
+ <para>怎样使这些库起作用?</para>
+ </question>
+ <answer>
+ <para>需要按照这些库提供的说明进行。一些库可以在运行 PHP 的
"configure"时自动检测到(例如 GD 库),其它的必需用"
+ <literal>--with-EXTENSION</literal>"选项来激活。运行"
+ <literal>configure --help</literal>"来得到完整的列表。</para>
+ </answer>
+ </qandaentry>
+ <qandaentry xml:id="faq.obtaining.compileNT">
+ <question>
+ <para>我在 Windows 机器中从 SVN 里得到了最新版的 PHP 源代码,需要什
么去编译它?</para>
+ </question>
+ <answer>
+ <para>首先,需要 Microsoft Visual C++ v6(v5 也许也行,不过我们是
用 v6 编译的),此外还需要一些支持文件。参见手册中的
+ <link linkend="install.windows.building">在 Windows 下编译 PHP 源代
码</link>一节。</para>
+ </answer>
+ </qandaentry>
+ <qandaentry xml:id="faq.obtaining.browscap">
+ <question>
+ <para>哪里可以找到 browscap.ini 文件?</para>
+ </question>
+ <answer>
+ <para>可以从
+ <link
xlink:href="&url.browscap.download;">&url.browscap.download;</link>得到一个
+ <filename>browscap.ini</filename>文件。</para>
+ </answer>
+ </qandaentry>
+ </qandaset>
+</chapter>
+<!-- Keep this comment at the end of the file
+Local variables:
+mode: sgml
+sgml-omittag:t
+sgml-shorttag:t
+sgml-minimize-attributes:nil
+sgml-always-quote-attributes:t
+sgml-indent-step:1
+sgml-indent-data:t
+indent-tabs-mode:nil
+sgml-parent-document:nil
+sgml-default-dtd-file:"~/.phpdoc/manual.ced"
+sgml-exposed-tags:nil
+sgml-local-catalogs:nil
+sgml-local-ecat-files:nil
+End:
+vim600: syn=xml fen fdm=syntax fdl=2 si
+vim: et tw=78 syn=sgml
+vi: ts=1 sw=1
+-->
=======================================
--- /dev/null
+++ /trunk/xml/faq/using.xml Mon Apr 9 09:11:24 2012
@@ -0,0 +1,352 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- $Revision: 324974 $ -->
+<!-- EN-Revision: 324522 Maintainer: HonestQiao Status: ready -->
+<!-- Reviewed: no Maintainer: HonestQiao -->
+<!-- $EN-Revision: 304574 $ -->
+<chapter xml:id="faq.using"
+ xmlns="http://docbook.org/ns/docbook"
+ xmlns:xlink="http://www.w3.org/1999/xlink">
+ <title>使用 PHP</title>
+ <titleabbrev>使用 PHP</titleabbrev>
+ <para>本节汇集了你在写 PHP 脚本时可能碰到的大多数普通错误。</para>
+ <qandaset>
+ <qandaentry xml:id="faq.using.parameterorder">
+ <question>
+ <para>我忘了PHP函数的参数顺序,它们是随机的吗?</para>
+ </question>
+ <answer>
+ <para>PHP is a glue that brings together hundreds of external
libraries, so sometimes this gets messy. However, a simple rule of thumb is
as follows:</para>
+ <para>
+ <link linkend="book.array">Array function</link>parameters are
ordered as &quot;
+ <emphasis>needle, haystack</emphasis>&quot; whereas
+ <link linkend="book.strings">String functions</link>are the
opposite, so &quot;
+ <emphasis>haystack, needle</emphasis>&quot;.</para>
+ </answer>
+ </qandaentry>
+ <qandaentry xml:id="faq.using.anyform">
+ <question>
+ <para>我想写一个可以处理任何表单来的数据的通用 PHP 脚本。我怎么知道
哪个 POST 方法变量可用呢?</para>
+ </question>
+ <answer>
+ <para>PHP 提供很多"
+ <link linkend="language.variables.predefined">预定义变量</link>",例
如超全局变量
+ <varname>$_POST</varname>。可以遍历
+ <varname>$_POST</varname>变量,因为它是一个和所有通过 POST 方法传递数
据相联系的数组。例如,可以用
+ &foreach;简单地遍历它,检查
+ <function>empty</function>值,以及将它们输出。
+ <programlisting role="php">
+ <![CDATA[
+<?php
+$empty = $post = array();
+foreach ($_POST as $varname => $varvalue) {
+ if (empty($varvalue)) {
+ $empty[$varname] = $varvalue;
+ } else {
+ $post[$varname] = $varvalue;
+ }
+}
+
+print "<pre>";
+if (empty($empty)) {
+ print "None of the POSTed values are empty, posted:\n";
+ var_dump($post);
+} else {
+ print "We have " . count($empty) . " empty values\n";
+ print "Posted:\n"; var_dump($post);
+ print "Empty:\n"; var_dump($empty);
+ exit;
+}
+?>
+]]>
+</programlisting></para>&note.superglobals;</answer>
+ </qandaentry>
+ <qandaentry xml:id="faq.using.addslashes">
+ <question>
+ <para>我需要在所有的单引号(&#39;)前加一个反斜线(\),使它们变成
(\&#39;),我如何能够通过正则表达式来实现?我同样希望能够将(&quot;)转换成
(\&quot;),将(\)转换成(\\)。</para>
+ </question>
+ <answer>
+ <para>函数
+ <function>addslashes</function>能够实现这种操作。请参阅函数
+ <function>mysql_escape_string</function>。另外,还可以用函数
+ <function>stripslashes</function>来去掉反斜线。
</para>&note.magicquotes.gpc;</answer>
+ </qandaentry>
+ <qandaentry xml:id="faq.using.stripslashes">
+ <question>
+ <para>我所有的(&quot;)和(&#39;)都被变成了(\&quot;)和
(\&#39;),我如何才能去掉这些不必要的反斜线?它们为什么及如何出现?</para>
+ </question>
+ <answer>
+ <para>PHP 函数
+ <function>stripslashes</function>能够从
+ <type>string</type>中去掉所有的反斜线。这些反斜线出现最有可能的原因
是 PHP 设置项
+ <link linkend="ini.magic-quotes-gpc">magic_quotes_gpc</link>被开启。
</para>&note.magicquotes.gpc;</answer>
+ </qandaentry>
+ <qandaentry xml:id="faq.register-globals">
+ <question>
+ <para>PHP 选项 register_globals 对我有什么影响?</para>
+ </question>
+ <answer>
+ <para>首先要理解这个设置选项的作用。假如我们使用以下URL:
+ <literal>http://example.com/foo.php?animal=cat</literal>,那么在
+ <filename>foo.php</filename>中我们可能会使用以下代码:</para>
+ <para>
+ <programlisting role="php">
+ <![CDATA[
+<?php
+// 建议使用这种访问变量的方式
+echo $_GET['animal'];
+
+// 如果想直接访问$animal变量,就要把register_globals选项设置为on
+// 强烈建议不要这么做!!
+echo $animal;
+
+// 这个选项的值会影响到所有变量,包括$_SERVER
+// 以下是该选项设置为off时的正确写法
+echo $_SERVER['PHP_SELF'];
+
+// 同样,要使$PHP_SELF变量自动生效,register_globals选项必须设置为on
+// 强烈建议不要这么做!!
+echo $PHP_SELF;
+?>
+]]>
+</programlisting>
+ </para>
+ <para>上面的代码解释了register_globals的作用,就是自动生成变量。这
种编程方式被很多人所不喜,所以在PHP当中register_globals默认设置为off。在
PHP6,这个选项被删除了。所以目前绝大部分虚拟主机都默认把register_globals禁
用。请注意,你在阅读过时的文章、教程时可能需要把该选项开启,否则可能示例代码
不能通过。但在实际开发当中,强烈建议将其设置为off,否则可能会导致安全问题。
</para>
+ <para>请参阅以下资源进一步了解:
+ <simplelist>
+ <member>The
+ <link linkend="ini.register-globals">register_globals</link>选项
</member>
+ <member>The
+ <link linkend="security.globals">注册全局变量的安全问题
</link></member>
+ <member>
+ <link linkend="language.variables.external">处理外部变量</link>
+ </member>
+ <member>Use
+ <link linkend="language.variables.superglobals">超级全局变量
</link></member>
+ </simplelist></para>
+ <note>
+ <para>以上示例中,我们使用了一个
+ <acronym>URL</acronym>,其中包含了一个QUERY_STRING。PHP会把
QUERY_STRING中的信息通过GET HTTP请求传递,所以我们可以通过超级全局变量
(superglobal)
+ <varname>$_GET</varname>来访问其中的变量。</para>
+ </note>
+ </answer>
+ </qandaentry>
+ <qandaentry xml:id="faq.using.wrong-order">
+ <question>
+ <para>当我这样做时,输出显示的次序是错的:
+ <programlisting role="php">
+ <![CDATA[
+<?php
+function myfunc($argument)
+{
+ echo $argument + 10;
+}
+$variable = 10;
+echo "myfunc($variable) = " . myfunc($variable);
+?>
+]]>
+</programlisting>这是怎么回事?</para>
+ </question>
+ <answer>
+ <para>要在一个表达式中(例如在上面的例子中和其它字符串连接)使用函
数的结果,需要
+ <function>return</function>这个值,而不是
+ <function>echo</function>它。</para>
+ </answer>
+ </qandaentry>
+ <qandaentry xml:id="faq.using.newlines">
+ <question>
+ <para>下面代码怎么没有分成两行显示?
+ <programlisting role="php">
+ <![CDATA[
+<pre>
+<?php echo "This should be the first line."; ?>
+<?php echo "This should show up after the new line above."; ?>
+</pre>
+]]>
+</programlisting></para>
+ </question>
+ <answer>
+ <para>在 PHP 中,一段代码的结束标记要么是"?&gt;"要么是
"?&gt;\n"(\n 表示换行)。因此在上面的例子中,输出的句子将显示在同一行中,因
为 PHP 忽略了代码结束标记后面的换行。这意味着如果要输出一个换行符,需要在每
段 PHP 代码的结束标记后面多加一个换行。</para>
+ <para>PHP 为什么这么做呢?因为在格式化正常的 HTML 时,这样通常会更
容易。假如输出了换行而你不需要这个换行时,就不得不用一个非常长的行来达到这样
的效果,或者让产生的 HTML 页面的源文件的格式很难读。</para>
+ </answer>
+ </qandaentry>
+ <qandaentry xml:id="faq.using.headers-sent">
+ <question>
+ <para>我得到消息"Warning: Cannot send session cookie - headers
already sent..."或者"Cannot add header information - headers already
sent..."。</para>
+ </question>
+ <answer>
+ <para>函数
+ <function>header</function>,
+ <function>setcookie</function>和
+ <link linkend="ref.session">session 函数</link>需要在输出流中添加头
信息。但是头信息只能在其它任何输出内容之前发送。在使用这些函数前不能有任何
(如 HTML)的输出。函数
+ <function>headers_sent</function>能够检查脚本是否已经发送了头信息。
请参阅
+ <link linkend="ref.outcontrol">输出控制函数</link>。</para>
+ </answer>
+ </qandaentry>
+ <qandaentry xml:id="faq.using.header">
+ <question>
+ <para>我需要直接访问请求报头中的信息,怎么能办到?</para>
+ </question>
+ <answer>
+ <para>如果以 Apache 的模块方式运行 PHP,那么函数
+ <function>getallheaders</function>可以做这件事。因此下面的代码可以
显示所有的请求报头:
+ <programlisting role="php">
+ <![CDATA[
+<?php
+$headers = getallheaders();
+foreach ($headers as $name => $content) {
+ echo "headers[$name] = $content<br />\n";
+}
+?>
+]]>
+</programlisting></para>
+ <para>请参阅函数
+ <function>apache_lookup_uri</function>、
+ <function>apache_response_headers</function>和
+ <function>fsockopen</function>。</para>
+ </answer>
+ </qandaentry>
+ <qandaentry xml:id="faq.using.authentication">
+ <question>
+ <para>当我用 IIS 进行 HTTP 认证时得到"No Input file specified"消
息。</para>
+ </question>
+ <answer>
+ <para>IIS 的安全模型这里有毛病。这是所有 IIS 下运行的 CGI 程序所共
有的问题。一个解决办法是建立一个纯 HTML 文件(不经过 PHP 解析)作为要进入认
证目录的登录页面,然后用 META 标记来重定向到 PHP 页面,或者用一个连接到 PHP
页面。然后 PHP 就可以正确识别认证信息了。如果是用 ISAPI 模块,那没有这个问
题。其它 NT 下的 web 服务器不受此影响。更多信息见
+ <link xlink:href="&url.iis;">&url.iis;</link>及
+ <link linkend="features.http-auth">HTTP 认证</link>一章。</para>
+ </answer>
+ </qandaentry>
+ <qandaentry xml:id="faq.using.iis.sharing">
+ <question>
+ <para>Windows:不能访问另一台电脑上用 IIS 共享的文件。</para>
+ </question>
+ <answer>
+ <para>必须要做些修改。打开
+ <literal>Internet 信息服务</literal>,找到你的 PHP 文件并打开属性
页,选择
+ <literal>文件安全性</literal>标签,点击
+ <literal>匿名访问和身份验证控制</literal>的"编辑"按钮。</para>
+ <para>解决此问题有两个方法,一是不要选中
+ <literal>匿名访问</literal>并且选中
+ <literal>集成 Windows 身份验证</literal>,二是选中
+ <literal>匿名访问</literal>并编辑匿名访问使用的帐户,改成一个有权限
的。</para>
+ </answer>
+ </qandaentry>
+ <qandaentry xml:id="faq.using.mixml">
+ <question>
+ <para>我怎样混合使用 XML 和 PHP?它不认我的 &lt;?xml 标记!</para>
+ </question>
+ <answer>
+ <para>要能够在 PHP 代码中直接嵌入 &lt;?xml,需要将 PHP 设置项
+ <link linkend="ini.short-open-tag">short_open_tags</link>设置为
+ <literal>0</literal>以关闭短标记格式。无法通过函数
+ <function>ini_set</function>来更改这项设置。不管
+ <link linkend="ini.short-open-tag">short_open_tags</link>是开或者
关,都可以用类似于
+ <literal>&lt;?php echo &#39;&lt;?xml&#39;; ?&gt;</literal>的方法达
到目的。该项设置的默认值为开。</para>
+ </answer>
+ </qandaentry>
+ <qandaentry xml:id="faq.using.editor">
+ <question>
+ <para>怎样用 FrontPage 或者其它非要把我的代码移来移去的 HTML 编辑器
来编辑 PHP?</para>
+ </question>
+ <answer>
+ <para>最简单的方法是让 PHP 代码也能使用 ASP 标记。这可以让你用 ASP
风格的 &lt;% 和 %&gt; 代码定界符。一些流行的 HTML 编辑器在处理此格式上更加智
能化一些(目前如此)。要使用 ASP 风格的标记,需要在 &php.ini; 中打开
+ <link linkend="ini.asp-tags">asp_tags</link>,或者用相应的 Apache
配置选项。</para>
+ </answer>
+ </qandaentry>
+ <qandaentry xml:id="faq.using.variables">
+ <question>
+ <para>哪里可以找到所有可用的 PHP 预定义变量的完整列表?</para>
+ </question>
+ <answer>
+ <para>请阅读手册中的
+ <link linkend="language.variables.predefined">预定义变量</link>一
章,该部分的文档已经包含了一部分可以用于你的脚本的预定义变量的列表。可用变量
的完整列表(及更多信息)可以通过调用
+ <function>phpinfo</function>函数来查阅。请务必阅读手册中
+ <link linkend="language.variables.external">来自 PHP 之外的变量
</link>一节,这部分文档阐述了外部变量的概念,例如来自 HTML 表单、Cookie 和
URL 的变量。</para>&note.registerglobals;</answer>
+ </qandaentry>
+ <qandaentry xml:id="faq.using.freepdf">
+ <question>
+ <para>怎样才能不用非免费的商业库(例如
+ <link linkend="ref.pdf">PDFLib</link>) 来生成 PDF 文档?我想要个免
费的并且不需要再连接别的 PDF 库。</para>
+ </question>
+ <answer>
+ <para>有几个选择,例如
+
+ <link xlink:href="&url.pdf.fpdf;">FPDF</link> 和
+ <link xlink:href="&url.pdf.tcpdf;">TCPDF</link>模块。
+ </para>
+ <para>
+ There is also the <link linkend="book.haru">Haru</link> extension
+ that uses the free libHaru external library.
+ </para>
+ </answer>
+ </qandaentry>
+ <qandaentry xml:id="faq.using.cgi-vars">
+ <question>
+ <para>我试着在用户自定义函数中访问一个标准的 CGI 变量(例如
$DOCUMENT_ROOT 或 $HTTP_REFERER),但是找不到,哪里出了错?</para>
+ </question>
+ <answer>
+ <para>首先非常重要的一点是 PHP 设置项
+ <link linkend="ini.register-globals">register_globals</link>同样会对
服务器端和环境变量产生影响。当 register_globals = off (从 PHP 4.2.0 开始其
默认值为 off),变量
+ <varname>$DOCUMENT_ROOT</varname>将不会存在,而只有
+ <varname>$_SERVER[&#39;DOCUMENT_ROOT&#39;]</varname>。如果
register_globals = on 则变量
+ <varname>$DOCUMENT_ROOT</varname>和
+ <varname>$GLOBALS[&#39;DOCUMENT_ROOT&#39;]</varname>将同时存在。
</para>
+ <para>如果确认 register_globals = on 但不知道为什么
+ <varname>$DOCUMENT_ROOT</varname>在函数内部不可用,这是因为它和其它的
变量一样需要在函数中执行
+ <literal>global $DOCUMENT_ROOT</literal>。请参阅手册中的
+ <link linkend="language.variables.scope">变量范围</link>一节。建议在
register_globals = off 的情况下进行编码。</para>&note.superglobals;</answer>
+ </qandaentry>
+ <qandaentry xml:id="faq.using.shorthandbytes">
+ <question>
+ <para>有些 PHP 选项可以接受缩写的字节值,与仅能接受
+ <type>integer</type>字节值相反。都有哪些缩写字节值?可以将其用于
&php.ini; 之外吗?</para>
+ </question>
+ <answer>
+ <para>可用的选择有 K(对应 Kilobytes),M(对应 Megabytes)和 G(对
应 Gigabytes;自 PHP 5.1.0 起可用),区分大小写。其余的都认为是字节。
+ <literal>1M</literal>等于一个 Megabyte,即
+ <literal>1048576</literal>字节。
+ <literal>1K</literal>等于一个 Kilobyte,即
+ <literal>1024</literal>字节。不能在 &php.ini; 之外使用这些符号,最
好用整数的
+ <type>integer</type>字节值。参见
+ <function>ini_get</function>文档中的转换示例。</para>
+ <note>
+ <title>kilobyte versus kibibyte</title>
+ <para>The PHP notation describes one kilobyte as equalling 1024
bytes, whereas the
+ <acronym>IEC</acronym>standard considers this to be a kibibyte
instead. Summary: k and K = 1024 bytes.</para>
+ </note>
+ </answer>
+ </qandaentry>
+ <qandaentry xml:id="faq.using.windowslocalhostissue">
+ <question>
+ <para>Windows: I keep getting connection timeouts when using
+ <literal>localhost</literal>, whereas
+ <literal>&quot;127.0.0.1&quot;</literal>works?</para>
+ </question>
+ <answer>
+ <para>Prior to PHP 5.3.4, there was a bug in the network resolving
code inside PHP that caused
+ <literal>localhost</literal>in all stream related situations to
fail if IPv6 was enabled. To work around this issue you can either use
+ <literal>&quot;127.0.0.1&quot;</literal>or disable IPv6 resolving
in the
+ <filename>hosts</filename>file.</para>
+ </answer>
+ </qandaentry>
+ </qandaset>
+</chapter>
+<!-- Keep this comment at the end of the file
+Local variables:
+mode: sgml
+sgml-omittag:t
+sgml-shorttag:t
+sgml-minimize-attributes:nil
+sgml-always-quote-attributes:t
+sgml-indent-step:1
+sgml-indent-data:t
+indent-tabs-mode:nil
+sgml-parent-document:nil
+sgml-default-dtd-file:"~/.phpdoc/manual.ced"
+sgml-exposed-tags:nil
+sgml-local-catalogs:nil
+sgml-local-ecat-files:nil
+End:
+vim600: syn=xml fen fdm=syntax fdl=2 si
+vim: et tw=78 syn=sgml
+vi: ts=1 sw=1
+-->
=======================================
--- /dev/null
+++ /trunk/xml/features/commandline.xml Mon Apr 9 09:11:24 2012
@@ -0,0 +1,1187 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- $Revision: 324974 $ -->
+<!-- EN-Revision: 324591 Maintainer: HonestQiao Status: ready -->
+<!-- Reviewed: no Maintainer: HonestQiao -->
+<!-- CREDITS: thomaslio, dallas -->
+<chapter xml:id="features.commandline"
xmlns="http://docbook.org/ns/docbook"
xmlns:xlink="http://www.w3.org/1999/xlink">
+ <title>PHP 的命令行模式</title>
+
+ <para>
+ 从版本 4.3.0 开始,PHP 提供了一种新类型的 &cli.sapi;(Server
+ Application Programming Interface,服务端应用编程端口)支持,名为
+ &cli;,意为 <emphasis>Command Line
+ Interface</emphasis>,即命令行接口。顾名思义,该
+ &cli.sapi; 模块主要用作 PHP 的开发外壳应用。<literal>CLI SAPI</literal>
+ 和其它 &cli.sapi;
+ 模块相比有很多的不同之处,我们将在本章中详细阐述。值得一提的是,&cli;
+ 和 <literal>CGI</literal> 是不同的 SAPI,尽管它们之间有很多共同的行为。
+ </para>
+
+ <para>
+ <literal>CLI SAPI</literal> 最先是随 PHP 4.2.0
+ 版本发布的,但仍旧只是一个实验性的版本,并需要在运行
+ <command>./configure</command> 时加上
+ <option role="configure">--enable-cli</option> 参数。从 PHP 4.3.0
+ 版本开始,<literal>CLI SAPI</literal> 成为了正式模块,<option
+ role="configure">--enable-cli</option> 参数会被默认得设置为
+ on,也可以用参数 <option role="configure">--disable-cli</option> 来屏蔽。
+ </para>
+
+ <para>
+ 从 PHP 4.3.0开始,CLI/CGI 二进制执行文件的文件名、位置和是否存在会根据
+ PHP 在系统上的安装而不同。在默认情况下,当运行
+ <command>make</command> 时,CGI 和 CLI 都会被编译并且分别放置在
+ PHP 源文件目录的 <filename>sapi/cgi/php</filename> 和
+ <filename>sapi/cli/php</filename> 下。可以注意到两个文件都被命名为了
+ php。在 <command>make install</command>
+ 的过程中会发生什么取决于配置行。如果在配置的时候选择了一个
+ SAPI 模块,如 apxs,或者使用了
+ <option role="configure">--disable-cgi</option> 参数,则在
+ <command>make install</command> 的过程中,CLI 将被拷贝到
+ <filename>{PREFIX}/bin/php</filename>,除非 CGI
+ 已经被放置在了那个位置。因此,例如,如果在配置行中有
+ <option role="configure">--with--apxs</option>,则在
+ <literal>make install</literal> 的过程中,CLI 将被拷贝到
+ <literal>{PREFIX}/bin/php</literal>。如果希望撤销 CGI
+ 执行文件的安装,请在 <command>make install</command>
+ 之后运行 <command>make install-cli</command>。或者,也可以在配置行中加上
+ <option role="configure">--disable-cgi</option> 参数。
+ </para>
+
+ <note>
+ <para>
+ 由于 <option role="configure">--enable-cli</option> 和
+ <option role="configure">--enable-cgi</option>
+ 同时默认有效,因此,不必再配置行中加上
+ <option role="configure">--enable-cli</option> 来使得 CLI 在
+ <command>make install</command> 过程中被拷贝到
+ <filename>{PREFIX}/bin/php</filename>。
+ </para>
+ </note>
+
+ <para>
+ 在 PHP 4.2.0 到 PHP 4.2.3 之间的 Windows 发行包中,CLI 的文件名为
+ <filename>php-cli.exe</filename>,相同文件夹下的
+ <filename>php.exe</filename> 为 CGI。从 PHP 4.3.0 版本开始,Windows
+ 的发行包中 CLI 的执行文件为
+ <filename>php.exe</filename>,被放置在一个单独的名为
+ <filename class="directory">cli</filename> 的文件夹下,即
+ <filename>cli/php.exe</filename>。在 PHP 5 中,CLI
+ 存在于主文件夹中,名为 <filename>php.exe</filename>,而
+ CGI 版本名为 <filename>php-cgi.exe</filename>。
+ </para>
+
+ <para>
+ 从 PHP 5 起,一个名为 <filename>php-win.exe</filename>
+ 的新文件随包发布。它相当于 CLI 版本,但是 php-win
+ 不输出任何内容,便不提供控制台(不会弹出"DOS 窗口")。这种方式类似于
+ php-gtk。需要使用
+ <option role="configure">--enable-cli-win32</option> 选项来配置它。
+ </para>
+
+ <note>
+ <title>如何得知自己使用的是哪个 SAPI?</title>
+ <para>
+ 在命令行下,运行 <command>php -v</command> 便能得知该
+ <filename>php</filename> 是 CGI 还是 CLI。请参考函数
+ <function>php_sapi_name</function> 以及常量
<constant>PHP_SAPI</constant>。
+ </para>
+ </note>
+
+ <note>
+ <para>
+ 在 PHP 4.3.2 中加入了 Unix 的 <literal>man</literal> 页面。可以在命令行
中键入
+ <command>man php</command> 来查看。
+ </para>
+ </note>
+
+ <para>
+ 以下为 <literal>CLI SAPI</literal> 和其它 &cli.sapi; 模块相比的显著区别:
+ <itemizedlist>
+ <listitem>
+ <para>
+ 与 <literal>CGI SAPI</literal> 不同,其输出没有任何头信息。
+ </para>
+ <para>
+ 尽管 <literal>CGI SAPI</literal> 提供了取消 HTTP 头信息的方法,但在
+ <literal>CLI SAPI</literal> 中并不存在类似的方法以开启 HTTP 头信息的输
出。
+ </para>
+ <para>
+ CLI 默认以安静模式开始,但为了保证兼容性,<option>-q</option> 和
+ <option>--no-header</option> 参数为了向后兼容仍然保留,使得可以使用旧
的 CGI 脚本。
+ </para>
+ <para>
+ 在运行时,不会把工作目录改为脚本的当前目录(可以使用
+ <option>-C</option> 和 <option>--no-chdir</option> 参数来兼容 CGI 模式
)。
+ </para>
+ <para>
+ 出错时输出纯文本的错误信息(非 HTML 格式)。
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <literal>CLI SAPI</literal> 强制覆盖了 &php.ini;
+ 中的某些设置,因为这些设置在外壳环境下是没有意义的。
+ </para>
+ <para>
+ <table>
+ <title>覆盖 &php.ini; 设置选项</title>
+ <tgroup cols="3">
+ <thead>
+ <row>
+ <entry>设置选项</entry>
+ <entry><literal>CLI SAPI</literal> 默认值</entry>
+ <entry>备注</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry><link linkend="ini.html-errors">html_errors</link></entry>
+ <entry>&false;</entry>
+ <entry>
+ 无意义的 HTML
+ 标记符会使得出错信息很凌乱,所以在外壳下阅读报错信息是十分困难
的。因此将该选项的默认值改为 &false;。
+ </entry>
+ </row>
+ <row>
+ <entry><link
linkend="ini.implicit-flush">implicit_flush</link></entry>
+ <entry>&true;</entry>
+ <entry>
+ 在命令行模式下,所有来自 <function>print</function> 和
+ <function>echo</function> 的输出将被立即写到输出端,而不作任何地
缓冲操作。如果希望延缓或控制标准输出,仍然可以使用
+ <link linkend="ref.outcontrol">output buffering</link> 设置项。
+ </entry>
+ </row>
+ <row>
+ <entry><link
linkend="ini.max-execution-time">max_execution_time</link></entry>
+ <entry>0(无限值)</entry>
+ <entry>
+ 鉴于在外壳环境下使用 PHP 的无穷的可能性,最大运行时间被设置为了无
限值。为
+ web 开发的应用程序可能只需运行几秒钟时间,而外壳应用程序的运行时
间可能会长的多。
+ </entry>
+ </row>
+ <row>
+ <entry><link
linkend="ini.register-argc-argv">register_argc_argv</link></entry>
+ <entry>&true;</entry>
+ <entry>
+ <para>
+ 由于该设置为 &true;,将总是可以在 <literal>CLI SAPI</literal>
+ 中访问到 <emphasis>argc</emphasis>(传送给应用程序参数的个数)和
+ <emphasis>argv</emphasis>(包含有实际参数的数组)。
+ </para>
+ <para>
+ 对于 PHP 4.3.0,在使用 <literal>CLI SAPI</literal> 时,PHP 变量
+ <literal>$argc</literal> 和 <literal>$argv</literal>
+ 已被注册并且设定了对应的值。而在这之前的版本,这两个变量在
+ <literal>CGI</literal> 或者 <literal>模块</literal>
+ 版本中的建立依赖于将 PHP 的设置选项
+ <link linkend="ini.register-globals">register_globals</link>
+ 设为 <emphasis>on</emphasis>。除了版本和
+ <literal>register_globals</literal> 设定以外,可以随时通过调用
+ <link linkend="reserved.variables.server">$_SERVER</link>
+ 或者 <varname>$HTTP_SERVER_VARS</varname>
+ 来访问它们。例如:<varname>$_SERVER['argv']</varname>
+ </para>
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ </para>
+ <note>
+ <para>
+ 这些设置无法在设置文件 &php.ini;
+ 或任何指定的其它文件中被初始化为其它值。这些默认值被限制在所有其它的
设置文件被解析后改变。不过,它们的值可以在程序运行的过程中被改变(尽管对于该
运行过程来说,这些设置项是没有意义的)。
+ </para>
+ </note>
+ </listitem>
+ <listitem>
+ <para>
+ 为了减轻外壳环境下的工作,我们定义了如下常量:
+ <table>
+ <title>CLI 专用常量</title>
+ <tgroup cols="2">
+ <thead>
+ <row>
+ <entry>常量名称</entry>
+ <entry>描 述</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry><constant>STDIN</constant></entry>
+ <entry>
+ 一个已打开的指向 <literal>stdin</literal> 的流。可以用如下方法来
调用:
+ <programlisting role="php">
+<![CDATA[
+<?php
+
+$stdin = fopen('php://stdin', 'r');
+
+?>
+]]>
+ </programlisting>
+ 如果想从 <literal>stdin</literal> 读取一行内容,可以使用
+ <programlisting role="php">
+<![CDATA[
+<?php
+$line = trim(fgets(STDIN)); // 从 STDIN 读取一行
+fscanf(STDIN, "%d\n", $number); // 从 STDIN 读取数字
+?>
+]]>
+ </programlisting>
+ </entry>
+ </row>
+ <row>
+ <entry><constant>STDOUT</constant></entry>
+ <entry>
+ 一个已打开的指向 <literal>stdout</literal> 的流。可以用如下方式来
调用:
+ <programlisting role="php">
+<![CDATA[
+<?php
+
+$stdout = fopen('php://stdout', 'w');
+
+?>
+]]>
+ </programlisting>
+ </entry>
+ </row>
+ <row>
+ <entry><constant>STDERR</constant></entry>
+ <entry>
+ 一个已打开的指向 <literal>stderr</literal> 的流。可以用如下方式来
调用:
+ <programlisting role="php">
+<![CDATA[
+<?php
+
+$stderr = fopen('php://stderr', 'w');
+
+?>
+]]>
+ </programlisting>
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ </para>
+ <para>
+ 有了以上常量,就无需自己建立指向诸如 <literal>stderr</literal>
+ 的流,只需简单的使用这些常量来代替流指向:
+ <programlisting role="shell">
+<![CDATA[
+php -r 'fwrite(STDERR, "stderr\n");'
+]]>
+ </programlisting>
+ 无需自己来关闭这些流,PHP 会自动完成这些操作。
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <literal>CLI SAPI</literal>
+ <emphasis role="strong">不会</emphasis>将当前目录改为已运行的脚本所在
的目录。
+ </para>
+ <para>
+ 以下范例显示了本模块与 <literal>CGI SAPI</literal> 模块之间的不同:
+ <programlisting role="php">
+<![CDATA[
+<?php
+// 名为 test.php 的简单测试程序
+echo getcwd(), "\n";
+?>
+]]>
+ </programlisting>
+ </para>
+ <para>
+ 在使用 <literal>CGI</literal> 版本时,其输出为
+ <screen>
+<![CDATA[
+$ pwd
+/tmp
+
+$ php-cgi -f another_directory/test.php
+/tmp/another_directory
+]]>
+ </screen>
+ </para>
+ <para>
+ 明显可以看到 PHP 将当前目录改成了刚刚运行过的脚本所在的目录。
+ </para>
+ <para>
+ 使用 <literal>CLI SAPI</literal> 模式,得到:
+ <screen>
+<![CDATA[
+$ pwd
+/tmp
+
+$ php -q another_directory/test.php
+/tmp
+]]>
+ </screen>
+ 这使得在利用 PHP 编写外壳工具时获得了很大的便利。
+ </para>
+ <note>
+ <para>
+ 可以在命令行运行时给该 <literal>CGI SAPI</literal> 加上
+ <option>-C</option> 参数,使其支持 <literal>CLI SAPI</literal> 的功
能。
+ </para>
+ </note>
+ </listitem>
+ </itemizedlist>
+ </para>
+ <para>
+ 以下是 PHP 二进制文件(即 <filename>php.exe</filename>
+ 程序)提供的命令行模式的选项参数,随时可以运行带
+ <option>-h</option> 参数的 PHP 命令来查询这些参数。
+ <screen>
+<![CDATA[
+Usage: php [options] [-f] <file> [--] [args...]
+ php [options] -r <code> [--] [args...]
+ php [options] [-B <begin_code>] -R <code> [-E <end_code>] [--]
[args...]
+ php [options] [-B <begin_code>] -F <file> [-E <end_code>] [--]
[args...]
+ php [options] -- [args...]
+ php [options] -a
+
+ -a Run interactively
+ -c <path>|<file> Look for php.ini file in this directory
+ -n No php.ini file will be used
+ -d foo[=bar] Define INI entry foo with value 'bar'
+ -e Generate extended information for debugger/profiler
+ -f <file> Parse <file>.
+ -h This help
+ -i PHP information
+ -l Syntax check only (lint)
+ -m Show compiled in modules
+ -r <code> Run PHP <code> without using script tags <?..?>
+ -B <begin_code> Run PHP <begin_code> before processing input lines
+ -R <code> Run PHP <code> for every input line
+ -F <file> Parse and execute <file> for every input line
+ -E <end_code> Run PHP <end_code> after processing all input lines
+ -H Hide any passed arguments from external tools.
+ -s Display colour syntax highlighted source.
+ -v Version number
+ -w Display source with stripped comments and whitespace.
+ -z <file> Load Zend extension <file>.
+
+ args... Arguments passed to script. Use -- args when first
argument
+ starts with - or script is read from stdin
+]]>
+ </screen>
+ </para>
+ <para>
+ <literal>CLI SAPI</literal> 模块有以下三种不同的方法来获取要运行的 PHP 代
码:
+ <orderedlist>
+ <listitem>
+ <para>
+ 让 PHP 运行指定文件。
+ </para>
+ <para>
+ <screen>
+<![CDATA[
+php my_script.php
+
+php -f my_script.php
+]]>
+ </screen>
+ </para>
+ <para>
+ 以上两种方法(使用或不使用 <option>-f</option> 参数)都能够运行给定的
+ <filename>my_script.php</filename> 文件。可以选择任何文件来运行,指定

+ PHP 脚本并非必须要以 <literal>.php</literal>
+ 为扩展名,它们可以有任意的文件名和扩展名。
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ 在命令行直接运行 PHP 代码。
+ </para>
+ <para>
+ <screen>
+<![CDATA[
+php -r 'print_r(get_defined_constants());'
+]]>
+ </screen>
+ </para>
+ <para>
+ 在使用这种方法时,请注意外壳变量的替代及引号的使用。
+ </para>
+ <note>
+ <para>
+ 请仔细阅读以上范例,在运行代码时没有开始和结束的标记符!加上
+ <option>-r</option> 参数后,这些标记符是不需要的,加上它们会导致语法
错误。
+ </para>
+ </note>
+ </listitem>
+ <listitem>
+ <para>
+ 通过标准输入(<literal>stdin</literal>)提供需要运行的 PHP 代码。
+ </para>
+ <para>
+ 以上用法提供了非常强大的功能,使得可以如下范例所示,动态地生成
+ PHP 代码并通过命令行运行这些代码:
+ <screen>
+<![CDATA[
+$ some_application | some_filter | php | sort -u >final_output.txt
+]]>
+ </screen>
+ </para>
+ </listitem>
+ </orderedlist>
+ </para>
+
+ <para>
+ 以上三种运行代码的方法不能同时使用。
+ </para>
+
+ <para>
+ 和所有的外壳应用程序一样,PHP 的二进制文件(<filename>php.exe</filename>
+ 文件)及其运行的 PHP 脚本能够接受一系列的参数。PHP
+ 没有限制传送给脚本程序的参数的个数(外壳程序对命令行的字符数有限制,但通
常都不会超过该限制)。传递给脚本的参数可在全局变量
+ <varname>$argv</varname> 中获取。该数组中下标为零的成员为脚本的名称(当
+ PHP 代码来自标准输入获直接用 <option>-r</option>
+ 参数以命令行方式运行时,该名称为"<literal>-</literal>")。另外,全局变量
+ <varname>$argc</varname> 存有 <varname>$argv</varname>
+ 数组中成员变量的个数(而非传送给脚本程序的参数的个数)。
+ </para>
+
+ <para>
+ 只要传送给脚本的参数不是以 <literal>-</literal>
+ 符号开头,就无需过多的注意什么。向脚本传送以
+ <literal>-</literal> 开头的参数会导致错误,因为 PHP
+ 会认为应该由它自身来处理这些参数。可以用参数列表分隔符
+ <literal>--</literal> 来解决这个问题。在 PHP
+ 解析完参数后,该符号后所有的参数将会被原样传送给脚本程序。
+ </para>
+
+ <para>
+ <screen>
+<![CDATA[
+# 以下命令将不会运行 PHP 代码,而只显示 PHP 命令行模式的使用说明:
+$ php -r 'var_dump($argv);' -h
+Usage: php [options] [-f] <file> [args...]
+[...]
+
+# 以下命令将会把"-h"参数传送给脚本程序,PHP 不会显示命令行模式的使用说明:
+$ php -r 'var_dump($argv);' -- -h
+array(2) {
+ [0]=>
+ string(1) "-"
+ [1]=>
+ string(2) "-h"
+}
+]]>
+ </screen>
+ </para>
+
+ <para>
+ 除此之外,还有另一个方法将 PHP 用于外壳脚本。可以在写一个脚本,并在第一行

+ <literal>#!/usr/bin/php</literal> 开头,在其后加上以 PHP
+ 开始和结尾标记符包含的正常的 PHP
+ 代码,然后为该文件设置正确的运行属性(例如:<command>chmod +x
test</command>)。该方法可以使得该文件能够像外壳脚本或 PERL 脚本一样被直接执
行。
+ <programlisting role="php">
+<![CDATA[
+#!/usr/bin/php
+<?php
+ var_dump($argv);
+?>
+]]>
+ </programlisting>
+ </para>
+
+ <para>
+ 假设改文件名为 <filename>test</filename> 并被放置在当前目录下,可以做如下
操作:
+ <screen>
+<![CDATA[
+$ chmod +x test
+$ ./test -h -- foo
+array(4) {
+ [0]=>
+ string(6) "./test"
+ [1]=>
+ string(2) "-h"
+ [2]=>
+ string(2) "--"
+ [3]=>
+ string(3) "foo"
+}
+]]>
+ </screen>
+ </para>
+
+ <para>
+ 正如所看到的,在向该脚本传送以 <literal>-</literal> 开头的参数时,脚本仍
然能够正常运行。
+ </para>
+
+ <para>
+ PHP 4.3.3 以来有效的长选项:
+ <table>
+ <title>命令行选项</title>
+ <tgroup cols="2">
+ <thead>
+ <row>
+ <entry>选项名称</entry>
+ <entry>长名称</entry>
+ <entry>说明</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>-a</entry>
+ <entry>--interactive</entry>
+ <entry>
+ <para>
+ 交互式运行 PHP。如果编译 PHP 时加入了 <link
+ linkend="ref.readline">Readline</link> 扩展(Windows
+ 下不可用),那将会得到一个很好的外壳,包括一个自动完成的功能(例如
可以在键入变量名的时候,按下
+ TAB 键,PHP 会自动完成该变量名)以及命令历史记录,可以用上下键来访
问。历史记录存在
+ <filename>~/.php_history</filename> 文件中。
+ </para>
+ <note>
+ <para>
+ 通过 <link
+ linkend="ini.auto-prepend-file">auto_prepend_file</link> 和 <link
+ linkend="ini.auto-append-file">auto_append_file</link>
+ 包含的文件在此模式下会被解析,但有些限制,例如函数必须在被调用之前
定义。
+ </para>
+ </note>
+ </entry>
+ </row>
+ <row>
+ <entry>-c</entry>
+ <entry>--php-ini</entry>
+ <entry>
+ <para>
+ 用该参数,可以指定一个放置 &php.ini;
+ 文件的目录,或者直接指定一个自定义的 <literal>INI</literal>
+ 文件(其文件名可以不是 &php.ini;),例如:
+ <screen>
+<![CDATA[
+$ php -c /custom/directory/ my_script.php
+
+$ php -c /custom/directory/custom-file.ini my_script.php
+]]>
+ </screen>
+ 如果不指定此选项,PHP 将在<link
+ linkend="configuration.file">默认位置</link>搜索文件。
+ </para>
+ </entry>
+ </row>
+ <row>
+ <entry>-n</entry>
+ <entry>--no-php-ini</entry>
+ <entry>
+ <para>
+ 完全忽略 &php.ini;。此参数在 PHP 4.3.0 以后有效。
+ </para>
+ </entry>
+ </row>
+ <row>
+ <entry>-d</entry>
+ <entry>--define</entry>
+ <entry>
+ <para>
+ 用该参数可以自行设置任何可以在 &php.ini;
+ 文件中设置的配置选项的值,其语法为:
+ <screen>
+<![CDATA[
+-d configuration_directive[=value]
+]]>
+ </screen>
+ </para>
+ <para>
+ 例子(因版面原因而折行显示):
+ <screen>
+<![CDATA[
+# 取值部分被省略,将会把配置选项设为 "1"
+$ php -d max_execution_time
+ -r '$foo = ini_get("max_execution_time"); var_dump($foo);'
+string(1) "1"
+
+# 取值部分为空白,将会把配置选项设为 ""
+php -d max_execution_time=
+ -r '$foo = ini_get("max_execution_time"); var_dump($foo);'
+string(0) ""
+
+# 配置选项将被设置成为任何 '=' 字符之后的值
+$ php -d max_execution_time=20
+ -r '$foo = ini_get("max_execution_time"); var_dump($foo);'
+string(2) "20"
+$ php
+ -d max_execution_time=doesntmakesense
+ -r '$foo = ini_get("max_execution_time"); var_dump($foo);'
+string(15) "doesntmakesense"
+]]>
+ </screen>
+ </para>
+ </entry>
+ </row>
+ <row>
+ <entry>-e</entry>
+ <entry>--profile-info</entry>
+ <entry>
+ <para>
+ 激活扩展信息模式,被用于调试/测试。
+ </para>
+ </entry>
+ </row>
+ <row>
+ <entry>-f</entry>
+ <entry>--file</entry>
+ <entry>
+ <para>
+ 解析并运行 <option>-f</option>
+ 选项给定的文件名。该参数为可选参数,可以省略,仅指明需要运行的文件
名即可。
+ </para>
+ </entry>
+ </row>
+ <row>
+ <entry>-h and -?</entry>
+ <entry>--help and --usage</entry>
+ <entry>
+ 使用该参数,可以得到完整的命令行参数的列表及这些参数作用的简单描述。
+ </entry>
+ </row>
+ <row>
+ <entry>-i</entry>
+ <entry>--info</entry>
+ <entry>
+ 该命令行参数会调用 <function>phpinfo</function>
+ 函数并显示出结果。如果 PHP 没有正常工作,建议执行
+ <command>php -i</command>
+ 命令来查看在信息表格之前或者对应的地方是否有任何错误信息输出。请注意
当使用
+ CGI 摸索时,输出的内容为 <literal>HTML</literal>
+ 格式,因此输出的信息篇幅较大。
+ </entry>
+ </row>
+ <row>
+ <entry>-l</entry>
+ <entry>--syntax-check</entry>
+ <entry>
+ <para>
+ 该参数提供了对指定 PHP
+ 代码进行语法检查的方便的方法。如果成功,则向标准输出写入
+ <literal>No syntax errors detected in &lt;filename&gt;</literal>
+ 字符串,并且外壳返回值为
+ <literal>0</literal>。如果失败,则输出
+ <literal>Errors parsing
+ &lt;filename&gt;</literal>
+ 以及内部解析器错误信息到标准输出,同时外壳返回值将别设置为
+ <literal>255</literal>。
+ </para>
+ <para>
+ 该参数将无法检查致命错误(如未定义函数),如果也希望检测致命错
误,请使用
+ <option>-f</option> 参数。
+ </para>
+ <note>
+ <para>
+ 该参数不能和 <option>-r</option> 一同使用。
+ </para>
+ </note>
+ </entry>
+ </row>
+ <row>
+ <entry>-m</entry>
+ <entry>--modules</entry>
+ <entry>
+ <para>
+ 使用该参数,PHP 将打印出内置以及已加载的 PHP 及 Zend 模块:
+ <screen>
+<![CDATA[
+$ php -m
+[PHP Modules]
+xml
+tokenizer
+standard
+session
+posix
+pcre
+overload
+mysql
+mbstring
+ctype
+
+[Zend Modules]
+]]>
+ </screen>
+ </para>
+ </entry>
+ </row>
+ <row>
+ <entry>-r</entry>
+ <entry>--run</entry>
+ <entry>
+ <para>
+ 使用该参数可以在命令行内运行单行 PHP
+ 代码。<emphasis role="strong">无需</emphasis>加上 PHP
+ 的起始和结束标识符(<literal>&lt;?php</literal> 和
+ <literal>?&gt;</literal>),否则将会导致语法解析错误。
+ </para>
+ <note>
+ <para>
+ 使用这种形式的 PHP 时,应注意避免和外壳环境进行的命令行参数替换相
冲突。
+ </para>
+ <para>
+ 显示语法解析错误的范例
+ <screen>
+<![CDATA[
+$ php -r "$foo = get_defined_constants();"
+Command line code(1) : Parse error - parse error, unexpected '='
+]]>
+ </screen>
+ 这里的问题在于即使使用了双引号
+ <literal>"</literal>,sh/bash 仍然实行了参数替换。由于
+ <varname>$foo</varname>
+ 没有被定义,被替换后它所在的位置变成了空字符,因此在运行时,实际被
+ PHP 读取的代码为:
+ <screen>
+<![CDATA[
+$ php -r " = get_defined_constants();"
+]]>
+ </screen>
+ 正确的方法是使用单引号
+ <literal>'</literal>。在用单引号引用的字符串中,变量不会被
+ sh/bash 还原成其原值。
+ <screen>
+<![CDATA[
+$ php -r '$foo = get_defined_constants(); var_dump($foo);'
+array(370) {
+ ["E_ERROR"]=>
+ int(1)
+ ["E_WARNING"]=>
+ int(2)
+ ["E_PARSE"]=>
+ int(4)
+ ["E_NOTICE"]=>
+ int(8)
+ ["E_CORE_ERROR"]=>
+ [...]
+]]>
+ </screen>
+ 如果使用的外壳不是 sh/bash,可能会碰到更多问题。请将碰到的 Bug
+ 向 <link xlink:href="&url.php.bugs;">&url.php.bugs;</link>
+ 报告。注意,当试图将 shell 变量用到代码中或者使用反斜线时仍然很容
易碰到问题。
+ </para>
+ </note>
+ <note>
+ <para>
+ <option>-r</option> 在 <emphasis>CLI</emphasis> SAPI
+ 中有效,在 <emphasis>CGI</emphasis> SAPI 中无效。
+ </para>
+ </note>
+ <note>
+ <para>
+ 此选项只用于非常基本的用途。因此一些配置指令(例如 <link
+ linkend="ini.auto-prepend-file">auto_prepend_file</link> 和 <link
+ linkend="ini.auto-append-file">auto_append_file</link>)在此模式下
被忽略。
+ </para>
+ </note>
+ </entry>
+ </row>
+ <row>
+ <entry>-B</entry>
+ <entry>--process-begin</entry>
+ <entry>
+ <para>
+ 在处理 stdin 之前先执行 PHP 代码。PHP 5 新加。
+ </para>
+ </entry>
+ </row>
+ <row>
+ <entry>-R</entry>
+ <entry>--process-code</entry>
+ <entry>
+ <para>
+ 对每个输入行都执行 PHP 代码。PHP 5 新加。
+ </para>
+ <para>
+ 此模式下有两个特殊变量:<varname>$argn</varname>
+ 和 <varname>$argi</varname>。<varname>$argn</varname>
+ 包含 PHP 当前处理的行内容,而
+ <varname>$argi</varname> 则包含该行号。
+ </para>
+ </entry>
+ </row>
+ <row>
+ <entry>-F</entry>
+ <entry>--process-file</entry>
+ <entry>
+ <para>
+ 对每个输入行都执行 PHP 文件。PHP 5 新加。
+ </para>
+ </entry>
+ </row>
+ <row>
+ <entry>-E</entry>
+ <entry>--process-end</entry>
+ <entry>
+ <para>
+ 在处理完输入后执行的 PHP 代码。PHP 5 新加。
+ </para>
+ <para>
+ 使用 <option>-B</option>,<option>-R</option> 和
+ <option>-E</option> 选项来计算一个项目总行数的例子。
+ <screen>
+<![CDATA[
+$ find my_proj | php -B '$l=0;' -R '$l += count(@file($argn));'
-E 'echo "Total Lines: $l\n";'
+Total Lines: 37328
+]]>
+ </screen>
+ </para>
+ </entry>
+ </row>
+ <row>
+ <entry>-s</entry>
+ <entry>--syntax-highlight and --syntax-highlight</entry>
+ <entry>
+ <para>
+ 显示有语法高亮色彩的源代码。
+ </para>
+ <para>
+ 该参数使用内建机制来解析文件并为其生成一个 <literal>HTML</literal>
+ 高亮版本并将结果写到标准输出。请注意该过程所做的只是生成了一个
+ <literal>&lt;code&gt; [...] &lt;/code&gt;</literal> 的
+ <literal>HTML</literal> 标记的块,并不包含任何的
<literal>HTML</literal> 头。
+ </para>
+ <note>
+ <para>
+ 该选项不能和 <option>-r</option> 参数同时使用。
+ </para>
+ </note>
+ </entry>
+ </row>
+ <row>
+ <entry>-v</entry>
+ <entry>--version</entry>
+ <entry>
+ <para>
+ 将 PHP,PHP SAPI 和 Zend 的版本信息写入标准输出。例如:
+ <screen>
+<![CDATA[
+$ php -v
+PHP 4.3.0 (cli), Copyright (c) 1997-2002 The PHP Group
+Zend Engine v1.3.0, Copyright (c) 1998-2002 Zend Technologies
+]]>
+ </screen>
+ </para>
+ </entry>
+ </row>
+ <row>
+ <entry>-w</entry>
+ <entry>--strip</entry>
+ <entry>
+ <para>
+ 显示除去了注释和多余空白的源代码。
+ </para>
+ <note>
+ <para>
+ 该选项不能和 <option>-r</option> 参数同时使用。
+ </para>
+ </note>
+ </entry>
+ </row>
+ <row>
+ <entry>-z</entry>
+ <entry>--zend-extension</entry>
+ <entry>
+ <para>
+ 加载 Zend 扩展库。如果仅给定一个文件名,PHP
+ 将试图从当前系统扩展库的默认路径(在 Linux
+ 系统下,该路径通常由 <filename>/etc/ld.so.conf</filename>
+ 指定)加载该扩展库。如果用一个绝对路径指定文件名,则不会使用系统的
扩展库默认路径。如果用相对路径指定的文件名,则
+ PHP 仅试图在当前目录的相对目录加载扩展库。
+ </para>
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ </para>
+
+ <para>
+ PHP 的命令行模式能使得 PHP 脚本能完全独立于 web 服务器单独运行。如果使用
+ Unix 系统,需要在 PHP
+ 脚本的最前面加上一行特殊的代码,使得它能够被执行,这样系统就能知道用哪个
程序去运行该脚本。在
+ Windows 平台下可以将 <filename>php.exe</filename> 和
<literal>.php</literal>
+ 文件的双击属性相关联,也可以编写一个批处理文件来用 PHP
+ 执行脚本。为 Unix 系统增加的第一行代码不会影响该脚本在
+ Windows 下的运行,因此也可以用该方法编写跨平台的脚本程序。以下是一个简单

+ PHP 命令行程序的范例。
+ </para>
+
+ <para>
+ <example>
+ <title>试图以命令行方式运行的 PHP 脚本(script.php)</title>
+ <programlisting role="php">
+<![CDATA[
+#!/usr/bin/php
+<?php
+
+if ($argc != 2 || in_array($argv[1],
array('--help', '-help', '-h', '-?'))) {
+?>
+
+This is a command line PHP script with one option.
+
+ Usage:
+ <?php echo $argv[0]; ?> <option>
+
+ <option> can be some word you would like
+ to print out. With the --help, -help, -h,
+ or -? options, you can get this help.
+
+<?php
+} else {
+ echo $argv[1];
+}
+?>
+]]>
+ </programlisting>
+ </example>
+ </para>
+
+ <para>
+ 在以上脚本中,用第一行特殊的代码来指明该文件应该由 PHP
+ 来执行。在这里使用 CLI 的版本,因此不会有 HTTP 头信息输出。在用
+ PHP 编写命令行应用程序时,可以使用两个参数:<varname>$argc</varname>
+ 和 <varname>$argv</varname>。前面一个的值是比参数个数大 1
+ 的整数(运行的脚本本身的名称也被当作一个参数)。第二个是包含有参数的数
组,其第一个元素为脚本的名称,下标为数字
+ 0(<varname>$argv[0]</varname>)。
+ </para>
+
+ <para>
+ 以上程序中检查了参数的个数是大于 1 个还是小于 1
+ 个。此外如果参数是
<option>--help</option>,<option>-help</option>,<option>-h</option>
+ 或 <option>-?</option>
+ 时,打印出帮助信息,并同时动态输出脚本的名称。如果还收到了其它参数,将其
显示出来。
+ </para>
+
+ <para>
+ 如果希望在 Unix 下运行以上脚本,需要使其属性为可执行文件,然后简单的运行
+ <command>script.php echothis</command> 或 <command>script.php
-h</command>。在
+ Windows 下,可以为此编写一个批处理文件:
+ </para>
+
+ <para>
+ <example>
+ <title>运行 PHP 命令行脚本的批处理文件(script.bat)</title>
+ <programlisting role="shell">
+<![CDATA[
+@C:\php\php.exe script.php %1 %2 %3 %
+]]>
+ </programlisting>
+ </example>
+ </para>
+
+ <para>
+ 假设将上述程序命名为 <filename>script.php</filename>,且
+ CLI 版的 <filename>php.exe</filename> 文件放置在
+ <filename>c:\php\cli\php.exe</filename>,该批处理文件会帮助将附加的参数传
给脚本程序:<command>script.bat
+ echothis</command> 或 <command>script.bat -h</command>。
+ </para>
+
+ <para>
+ 请参阅 <link linkend="ref.readline">Readline</link>
+ 扩展模块的有关文档,以获取更多的函数的信息。这些函数可以帮助完善 PHP 命令
行应用程序。
+ </para>
+
+ <!--Built-in CLI Web Server: {{{-->
+ <section xml:id="features.commandline.webserver">
+ <title>Built-in web server</title>
+
+ <para>
+ As of PHP 5.4.0, the &cli.sapi; provides a built-in web server.
+ </para>
+
+ <para>
+ This web server is designed for developmental purposes only, and should
not
+ be used in production.
+ </para>
***The diff for this file has been truncated for email.***
=======================================
--- /dev/null
+++ /trunk/xml/features/connection-handling.xml Mon Apr 9 09:11:24 2012
@@ -0,0 +1,75 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- $Revision: 324974 $ -->
+<!-- EN-Revision: 297028 Maintainer: HonestQiao Status: ready -->
+<!-- Reviewed: no Maintainer: HonestQiao -->
+<!-- CREDITS: Gregory -->
+<chapter xml:id="features.connection-handling"
xmlns="http://docbook.org/ns/docbook">
+ <title>连接处理</title>
+
+ <para>
+ 在 PHP 内部,系统维护着连接状态,其状态有三种可能的情况:
+ <itemizedlist>
+ <listitem><simpara>0 - NORMAL(正常)</simpara></listitem>
+ <listitem><simpara>1 - ABORTED(异常退出)</simpara></listitem>
+ <listitem><simpara>2 - TIMEOUT(超时)</simpara></listitem>
+ </itemizedlist>
+ </para>
+
+ <simpara>
+ 当 PHP 脚本正常地运行 NORMAL 状态时,连接为有效。当远程客户端中断连接
时,ABORTED
+ 状态的标记将会被打开。远程客户端连接的中断通常是由用户点击 STOP
+ 按钮导致的。当连接时间超过 PHP 的时限(请参阅
+ <function>set_time_limit</function> 函数)时,TIMEOUT 状态的标记将被打
开。
+ </simpara>
+
+ <simpara>
+ 可以决定脚本是否需要在客户端中断连接时退出。有时候让脚本完整地运行会带来
很多方便,即使没有远程浏览器接受脚本的输出。默认的情况是当远程客户端连接中断
时脚本将会退出。该处理过程可由
+ &php.ini; 的 ignore_user_abort 或由 &httpd.conf;
+ 设置中对应的"php_value ignore_user_abort"以及
+ <function>ignore_user_abort</function> 函数来控制。如果没有告诉 PHP
+ 忽略用户的中断,脚本将会被中断,除非通过
+ <function>register_shutdown_function</function>
+ 设置了关闭触发函数。通过该关闭触发函数,当远程用户点击 STOP
+ 按钮后,脚本再次尝试输出数据时,PHP 将会检测到连接已被中断,并调用关闭触
发函数。
+ </simpara>
+
+ <simpara>
+ 脚本也有可能被内置的脚本计时器中断。默认的超时限制为 30
+ 秒。这个值可以通过设置 &php.ini; 的
+ <option>max_execution_time</option> 或 &httpd.conf;
+ 设置中对应的"<literal>php_value max_execution_time</literal>"参数或者
+ <function>set_time_limit</function>
+ 函数来更改。当计数器超时的时候,脚本将会类似于以上连接中断的情况退出,先
前被注册过的关闭触发函数也将在这时被执行。在该关闭触发函数中,可以通过调用
+ <function>connection_status</function>
+ 函数来检查超时是否导致关闭触发函数被调用。如果超时导致了关闭触发函数的调
用,该函数将返回 2。
+ </simpara>
+
+ <simpara>
+ 需要注意的一点是 ABORTED 和 TIMEOUT
+ 状态可以同时有效。这在告诉 PHP 忽略用户的退出操作时是可能的。PHP
+ 将仍然注意用户已经中断了连接但脚本仍然在运行的情况。如果到了运行的时间限
制,脚本将被退出,设置过的关闭触发函数也将被执行。在这时会发现函数
+ <function>connection_status</function> 返回 3。
+ </simpara>
+
+</chapter>
+
+<!-- Keep this comment at the end of the file
+Local variables:
+mode: sgml
+sgml-omittag:t
+sgml-shorttag:t
+sgml-minimize-attributes:nil
+sgml-always-quote-attributes:t
+sgml-indent-step:1
+sgml-indent-data:t
+indent-tabs-mode:nil
+sgml-parent-document:nil
+sgml-default-dtd-file:"~/.phpdoc/manual.ced"
+sgml-exposed-tags:nil
+sgml-local-catalogs:nil
+sgml-local-ecat-files:nil
+End:
+vim600: syn=xml fen fdm=syntax fdl=2 si
+vim: et tw=78 syn=sgml
+vi: ts=1 sw=1
+-->
=======================================
--- /dev/null
+++ /trunk/xml/features/safe-mode.xml Mon Apr 9 09:11:24 2012
@@ -0,0 +1,572 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- $Revision: 324974 $ -->
+<!-- EN-Revision: 323756 Maintainer: HonestQiao Status: ready -->
+<!-- Reviewed: no Maintainer: HonestQiao -->
+<!-- CREDITS: Gregory, dallas -->
+<chapter xml:id="features.safe-mode" xmlns="http://docbook.org/ns/docbook">
+ <title>安全模式</title>
+
+ <para>
+ PHP 的安全模式是为了试图解决共享服务器(shared-server)安全问题而设立的。
在结构上,试图在
+ PHP 层上解决这个问题是不合理的,但修改 web
+ 服务器层和操作系统层显得非常不现实。因此许多人,特别是 ISP,目前使用安全
模式。
+ </para>
+&warn.deprecated.feature-5-3-0.removed-5-4-0;
+
+ <para>
+ <table>
+ <title>Changelog for <literal>safe mode</literal></title>
+ <tgroup cols="2">
+ <thead>
+ <row>
+ <entry>&Version;</entry>
+ <entry>&Description;</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>5.4.0</entry>
+ <entry>
+ Removed from PHP, and generates a fatal
<constant>E_CORE_ERROR</constant>
+ level error when enabled.
+ </entry>
+ </row>
+ <row>
+ <entry>5.3.0</entry>
+ <entry>
+ Deprecated, and <constant>E_DEPRECATED</constant> errors were
added.
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ </para>
+
+ <sect1 xml:id="ini.sect.safe-mode">
+ <title>保安措施和安全模式</title>
+ <para>
+ <table>
+ <title>保安措施和安全模式配置指令</title>
+ <tgroup cols="4">
+ <thead>
+ <row>
+ <entry>&Name;</entry>
+ <entry>&Default;</entry>
+ <entry>&Changeable;</entry>
+ <entry>&Changelog;</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>safe_mode</entry>
+ <entry>"0"</entry>
+ <entry>PHP_INI_SYSTEM</entry>
+ <entry></entry>
+ </row>
+ <row>
+ <entry>safe_mode_gid</entry>
+ <entry>"0"</entry>
+ <entry>PHP_INI_SYSTEM</entry>
+ <entry>自 PHP 4.1.0 起可用</entry>
+ </row>
+ <row>
+ <entry>safe_mode_include_dir</entry>
+ <entry>NULL</entry>
+ <entry>PHP_INI_SYSTEM</entry>
+ <entry>自 PHP 4.1.0 起可用</entry>
+ </row>
+ <row>
+ <entry>safe_mode_exec_dir</entry>
+ <entry>""</entry>
+ <entry>PHP_INI_SYSTEM</entry>
+ <entry></entry>
+ </row>
+ <row>
+ <entry>safe_mode_allowed_env_vars</entry>
+ <entry>"PHP_"</entry>
+ <entry>PHP_INI_SYSTEM</entry>
+ <entry></entry>
+ </row>
+ <row>
+ <entry>safe_mode_protected_env_vars</entry>
+ <entry>"LD_LIBRARY_PATH"</entry>
+ <entry>PHP_INI_SYSTEM</entry>
+ <entry></entry>
+ </row>
+ <row>
+ <entry>open_basedir</entry>
+ <entry>NULL</entry>
+ <entry>PHP_INI_SYSTEM</entry>
+ <entry></entry>
+ </row>
+ <row>
+ <entry>disable_functions</entry>
+ <entry>""</entry>
+ <entry>仅 &php.ini;</entry>
+ <entry>自 PHP 4.0.1 起可用</entry>
+ </row>
+ <row>
+ <entry>disable_classes</entry>
+ <entry>""</entry>
+ <entry>仅 &php.ini;</entry>
+ <entry>自 PHP 4.3.2 起可用</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ &ini.php.constants;
+ </para>
+
+ &ini.descriptions.title;
+
+ <para>
+ <variablelist>
+ <varlistentry xml:id="ini.safe-mode">
+ <term>
+ <parameter>safe_mode</parameter>
+ <type>boolean</type>
+ </term>
+ <listitem>
+ <para>
+ 是否启用 PHP 的安全模式。
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry xml:id="ini.safe-mode-gid">
+ <term>
+ <parameter>safe_mode_gid</parameter>
+ <type>boolean</type>
+ </term>
+ <listitem>
+ <para>
+ 默认情况下,安全模式在打开文件时会做 UID 比较检查。如果想将其放宽到
+ GID 比较,则打开 safe_mode_gid。是否在文件访问时使用
+ <literal>UID</literal>(&false;)或者
+ <literal>GID</literal>(&true;)来做检查。
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry xml:id="ini.safe-mode-include-dir">
+ <term>
+ <parameter>safe_mode_include_dir</parameter>
+ <type>string</type>
+ </term>
+ <listitem>
+ <para>
+ 当从此目录及其子目录(目录必须在 <link
linkend="ini.include-path">include_path</link>
+ 中或者用完整路径来包含)包含文件时越过
+ <literal>UID</literal>/<literal>GID</literal> 检查。
+ </para>
+ <simpara>
+ 从 PHP 4.2.0 开始,本指令可以接受和 <link
+ linkend="ini.include-path">include_path</link>
+ 指令类似的风格用冒号(Windows 中是分号)隔开的路径,而不只是一个目
录。
+ </simpara>
+ <simpara>
+ 指定的限制实际上是一个前缀,而非一个目录名。这也就是说
"safe_mode_include_dir
+ = /dir/incl"将允许访问"/dir/include"和"/dir/incls",如果它们存在的
话。如果希望将访问控制在一个指定的目录,那么请在结尾加上一个斜线,例
如:"safe_mode_include_dir
+ = /dir/incl/"。
+ </simpara>
+ <simpara>
+ 如果本指令的值为空,在 PHP 4.2.3 中以及 PHP 4.3.3 起具有不同
+ <literal>UID</literal>/<literal>GID</literal>
+ 的文件将不能被包含。在较早版本中,所有文件都能被包含。
+ </simpara>
+ </listitem>
+ </varlistentry>
+ <varlistentry xml:id="ini.safe-mode-exec-dir">
+ <term>
+ <parameter>safe_mode_exec_dir</parameter>
+ <type>string</type>
+ </term>
+ <listitem>
+ <para>
+ 如果 PHP 使用了安全模式,<function>system</function> 和其它<link
+ linkend="ref.exec">程序执行函数</link>将拒绝启动不在此目录中的程序。
必须使用
+ <literal>/</literal> 作为目录分隔符,包括 Windows 中。
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry xml:id="ini.safe-mode-allowed-env-vars">
+ <term>
+ <parameter>safe_mode_allowed_env_vars</parameter>
+ <type>string</type>
+ </term>
+ <listitem>
+ <para>
+ 设置某些环境变量可能是潜在的安全缺口。本指令包含有一个逗号分隔的前缀
列表。在安全模式下,用户只能改变那些名字具有在这里提供的前缀的环境变量。默认
情况下,用户只能设置以
+ PHP_ 开头的环境变量(例如 PHP_FOO = BAR)。
+ </para>
+ <note>
+ <para>
+ 如果本指令为空,PHP 将使用户可以修改任何环境变量!
+ </para>
+ </note>
+ </listitem>
+ </varlistentry>
+ <varlistentry xml:id="ini.safe-mode-protected-env-vars">
+ <term>
+ <parameter>safe_mode_protected_env_vars</parameter>
+ <type>string</type>
+ </term>
+ <listitem>
+ <para>
+ 本指令包含有一个逗号分隔的环境变量的列表,最终用户不能用
+ <function>putenv</function> 来改变这些环境变量。甚至在
+ safe_mode_allowed_env_vars 中设置了允许修改时也不能改变这些变量。
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </para>
+ <para>
+ 参见 <link linkend="ini.register-globals">register_globals</link>,<link
+ linkend="ini.display-errors">display_errors</link> 和 <link
+ linkend="ini.log-errors">log_errors</link>。
+ </para>
+
+ <para>
+ 当 <link linkend="ini.safe-mode">safe_mode</link> 设置为 on,PHP
+ 将通过文件函数或其目录检查当前脚本的拥有者是否和将被操作的文件的拥有者相
匹配。例如:
+ <programlisting role="ls">
+<![CDATA[
+-rw-rw-r-- 1 rasmus rasmus 33 Jul 1 19:20 script.php
+-rw-r--r-- 1 root root 1116 May 26 18:01 /etc/passwd
+]]>
+ </programlisting>
+ 运行 script.php
+ <programlisting role="php">
+<![CDATA[
+<?php
+ readfile('/etc/passwd');
+?>
+]]>
+ </programlisting>
+ 如果安全模式被激活,则将会导致以下错误:
+ <screen>
+<![CDATA[
+Warning: SAFE MODE Restriction in effect. The script whose uid is 500 is
not
+allowed to access /etc/passwd owned by uid 0 in /docroot/script.php on
line 2
+]]>
+ </screen>
+ </para>
+ <para>
+ 同时,或许会存在这样的环境,在该环境下,宽松的 <literal>GID</literal>
+ 检查已经足够,但严格的 <literal>UID</literal>
+ 检查反而是不适合的。可以用 <link
linkend="ini.safe-mode-gid">safe_mode_gid</link>
+ 选项来控制这种检查。如果设置为 <literal>On</literal>
+ 则进行宽松的 <literal>GID</literal> 检查;设置为
+ <literal>Off</literal>(默认值)则进行 <literal>UID</literal> 检查。
+ </para>
+ <para>
+ 除了 <link linkend="ini.safe-mode">safe_mode</link> 以外,如果设置了
+ <link linkend="ini.open-basedir">open_basedir</link>
+ 选项,则所有的文件操作将被限制在指定的目录下。例如:
+ <programlisting role="ini">
+<![CDATA[
+<Directory /docroot>
+ php_admin_value open_basedir /docroot
+</Directory>
+]]>
+ </programlisting>
+ 如果在设置了 <link linkend="ini.open-basedir">open_basedir</link>
+ 选项后运行同样的 script.php,则其结果会是:
+ <screen>
+<![CDATA[
+Warning: open_basedir restriction in effect. File is in wrong directory in
+/docroot/script.php on line 2
+]]>
+ </screen>
+ </para>
+ <para>
+ 也可以单独地屏蔽某些函数。请注意
+ <link linkend="ini.disable-functions">disable_functions</link>
+ 选项不能在 &php.ini; 文件外部使用,也就是说无法在 &httpd.conf;
+ 文件的按不同虚拟主机或不同目录的方式来屏蔽函数。如果将如下内容加入到
+ &php.ini; 文件:
+ <programlisting role="ini">
+<![CDATA[
+disable_functions readfile,system
+]]>
+ </programlisting>
+ 则会得到如下的输出:
+ <screen>
+<![CDATA[
+Warning: readfile() has been disabled for security reasons in
+/docroot/script.php on line 2
+]]>
+ </screen>
+ </para>
+ <warning>
+ <para>
+ 当然,这些 PHP 限制不适用于可执行文件。
+ </para>
+ </warning>
+ </sect1>
+
+ <sect1 xml:id="features.safe-mode.functions">
+ <title>被安全模式限制或屏蔽的函数</title>
+ <para>
+ 以下<link linkend="features.safe-mode">安全模式</link>列表可能不完整或不
正确。
+ <!-- TODO: add &note.sm.*; to the functions mentioned here.
+ That entity should link to this section -->
+ <table>
+ <title>安全模式限制函数</title>
+ <tgroup cols="2">
+ <thead>
+ <row>
+ <entry>函数名</entry>
+ <entry>限制</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry><function>dbmopen</function></entry>
+ <entry>&sm.uidcheck;</entry>
+ </row>
+ <row>
+ <entry><function>dbase_open</function></entry>
+ <entry>&sm.uidcheck;</entry>
+ </row>
+ <row>
+ <entry><function>filepro</function></entry>
+ <entry>&sm.uidcheck;</entry>
+ </row>
+ <row>
+ <entry><function>filepro_rowcount</function></entry>
+ <entry>&sm.uidcheck;</entry>
+ </row>
+ <row>
+ <entry><function>filepro_retrieve</function></entry>
+ <entry>&sm.uidcheck;</entry>
+ </row>
+ <row>
+ <entry>ifx_*</entry>
+ <entry>sql_safe_mode 限制, (!= safe mode)</entry>
+ <!-- TODO: more info on sql-safe-mode -->
+ </row>
+ <row>
+ <entry>ingres_*</entry>
+ <entry>sql_safe_mode 限制, (!= safe mode)</entry>
+ <!-- TODO: more info on sql-safe-mode -->
+ </row>
+ <row>
+ <entry>mysql_*</entry>
+ <entry>sql_safe_mode 限制, (!= safe mode)</entry>
+ <!-- TODO: more info on sql-safe-mode -->
+ </row>
+ <row>
+ <entry><function>pg_loimport</function></entry>
+ <entry>&sm.uidcheck;</entry>
+ <!-- source TODO: there is no PHP-warning for that
safe-mode-restriction -->
+ </row>
+ <row>
+ <entry><function>posix_mkfifo</function></entry>
+ <entry>&sm.uidcheck.dir;</entry>
+ </row>
+ <row>
+ <entry><function>putenv</function></entry>
+ <entry>
+ 遵循 ini 设置的 safe_mode_protected_env_vars 和
safe_mode_allowed_env_vars
+ 选项。请参考 <function>putenv</function> 函数的有关文档。
+ </entry>
+ <!-- TODO: document those directives in chapters/config.xml -->
+ </row>
+ <row>
+ <entry><function>move_uploaded_file</function></entry>
+ <entry>&sm.uidcheck; <!-- TODO: check this --></entry>
+ </row>
+ <!-- TODO: from here on, add warning to the function itself -->
+ <row>
+ <entry><function>chdir</function></entry>
+ <entry>&sm.uidcheck.dir;</entry>
+ </row>
+ <row>
+ <entry><function>dl</function></entry>
+ <entry>&sm.disabled;</entry>
+ </row>
+ <row>
+ <entry><link linkend="language.operators.execution">backtick
operator</link></entry>
+ <entry>&sm.disabled;</entry>
+ </row>
+ <row>
+ <entry><function>shell_exec</function>(在功能上和 backticks 函数相
同)</entry>
+ <entry>&sm.disabled;</entry>
+ </row>
+ <row>
+ <entry><function>exec</function></entry>
+ <entry>
+ 只能在 <link
linkend="ini.safe-mode-exec-dir">safe_mode_exec_dir</link>
+ 设置的目录下进行执行操作。基于某些原因,目前不能在可执行对象的路径
中使用
+ <literal>..</literal>。<function>escapeshellcmd</function> 将被作用
于此函数的参数上。
+ </entry>
+ </row>
+ <row>
+ <entry><function>system</function></entry>
+ <entry>
+ 只能在 <link
linkend="ini.safe-mode-exec-dir">safe_mode_exec_dir</link>
+ 设置的目录下进行执行操作。基于某些原因,目前不能在可执行对象的路径
中使用
+ <literal>..</literal>。<function>escapeshellcmd</function> 将被作用
于此函数的参数上。
+ </entry>
+ </row>
+ <row>
+ <entry><function>passthru</function></entry>
+ <entry>
+ 只能在 <link
linkend="ini.safe-mode-exec-dir">safe_mode_exec_dir</link>
+ 设置的目录下进行执行操作。基于某些原因,目前不能在可执行对象的路径
中使用
+ <literal>..</literal>。<function>escapeshellcmd</function> 将被作用
于此函数的参数上。
+ </entry>
+ </row>
+ <row>
+ <entry><function>popen</function></entry>
+ <entry>
+ 只能在 <link
linkend="ini.safe-mode-exec-dir">safe_mode_exec_dir</link>
+ 设置的目录下进行执行操作。基于某些原因,目前不能在可执行对象的路径
中使用
+ <literal>..</literal>。<function>escapeshellcmd</function> 将被作用
于此函数的参数上。
+ </entry>
+ <!-- TODO: not sure. popen uses a completely different
implementation
+ Don't know why, don't know whether it's behaving the same -->
+ </row>
+ <row>
+ <entry><function>fopen</function></entry>
+ <entry>&sm.uidcheck.dir;</entry>
+ </row>
+ <row>
+ <entry><function>mkdir</function></entry>
+ <entry>&sm.uidcheck.dir;</entry>
+ </row>
+ <row>
+ <entry><function>rmdir</function></entry>
+ <entry>&sm.uidcheck.dir;</entry>
+ </row>
+ <row>
+ <entry><function>rename</function></entry>
+ <entry>&sm.uidcheck; &sm.uidcheck.dir;<!-- on the old name only, it
seems. Is rename preventing moving files? --></entry>
+ </row>
+ <row>
+ <entry><function>unlink</function></entry>
+ <entry>&sm.uidcheck; &sm.uidcheck.dir;</entry>
+ </row>
+ <row>
+ <entry><function>copy</function></entry>
+ <entry>&sm.uidcheck; &sm.uidcheck.dir; (on
+ <parameter>source</parameter> and
+ <parameter>target</parameter>) </entry>
+ </row>
+ <row>
+ <entry><function>chgrp</function></entry>
+ <entry>&sm.uidcheck;</entry>
+ </row>
+ <row>
+ <entry><function>chown</function></entry>
+ <entry>&sm.uidcheck;</entry>
+ </row>
+ <row>
+ <entry><function>chmod</function></entry>
+ <entry>&sm.uidcheck; 另外,不能设置 SUID、SGID 和 sticky
bits</entry>
+ </row>
+ <row>
+ <entry><function>touch</function></entry>
+ <entry>&sm.uidcheck; &sm.uidcheck.dir;</entry>
+ </row>
+ <row>
+ <entry><function>symlink</function></entry>
+ <entry>&sm.uidcheck; &sm.uidcheck.dir; (注意:仅测试
target)</entry>
+ </row>
+ <row>
+ <entry><function>link</function></entry>
+ <entry>&sm.uidcheck; &sm.uidcheck.dir; (注意:仅测试
target)</entry>
+ </row>
+ <row>
+ <entry><function>apache_request_headers</function></entry>
+ <entry>在安全模式下,以"authorization"(区分大小写)开头的标头将不会
被返回。
+ </entry>
+ </row>
+ <row>
+ <entry><function>header</function></entry>
+ <entry>在安全模式下,如果设置了
+ <literal>WWW-Authenticate</literal>,当前脚本的 uid
+ 将被添加到该标头的 <literal>realm</literal> 部分。</entry>
+ </row>
+ <row>
+ <entry><link linkend="features.http-auth">PHP_AUTH 变量
</link></entry>
+ <entry>
+ 在安全模式下,变量 <varname>PHP_AUTH_USER</varname>、
<varname>PHP_AUTH_PW</varname> 和 <varname>PHP_AUTH_TYPE</varname> 在
<varname>$_SERVER</varname> 中不可用。但无论如何,您仍然可以使用
<varname>REMOTE_USER</varname> 来获取用户名称(USER)。(注意:仅 PHP 4.3.0
以后有效)
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <function>highlight_file</function>,
+ <function>show_source</function>
+ </entry>
+ <entry>
+ &sm.uidcheck; &sm.uidcheck.dir; (注意,仅在 4.2.1 版本后有效)
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <function>parse_ini_file</function>
+ </entry>
+ <entry>
+ &sm.uidcheck; &sm.uidcheck.dir; (注意,仅在 4.2.1 版本后有效)
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <function>set_time_limit</function>
+ </entry>
+ <entry>
+ 在&safemode;下不起作用。
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <link linkend="ini.max-execution-time">max_execution_time</link>
+ </entry>
+ <entry>
+ 在&safemode;下不起作用。
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <function>mail</function>
+ </entry>
+ <entry>
+ 在安全模式下,第五个参数被屏蔽。(注意,仅自 PHP 4.2.3 起受影响)
+ </entry>
+ </row>
+ <row>
+ <entry>
+ 任何使用
+ <filename>php4/main/fopen_wrappers.c</filename> 的函数
+ </entry>
+ <entry>??</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ </para>
+ </sect1>
+
+</chapter>
+
+<!-- Keep this comment at the end of the file
+Local variables:
+mode: sgml
+sgml-omittag:t
+sgml-shorttag:t
+sgml-minimize-attributes:nil
+sgml-always-quote-attributes:t
+sgml-indent-step:1
+sgml-indent-data:t
+indent-tabs-mode:nil
+sgml-parent-document:nil
+sgml-default-dtd-file:"~/.phpdoc/manual.ced"
+sgml-exposed-tags:nil
+sgml-local-catalogs:nil
+sgml-local-ecat-files:nil
+End:
+vim600: syn=xml fen fdm=syntax fdl=2 si
+vim: et tw=78 syn=sgml
+vi: ts=1 sw=1
+-->
=======================================
--- /dev/null
+++ /trunk/xml/install/ini.xml Mon Apr 9 09:11:24 2012
@@ -0,0 +1,353 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- $Revision: 324974 $ -->
+<!-- EN-Revision: 323870 Maintainer: HonestQiao Status: ready -->
+<!-- Reviewed: no Maintainer: HonestQiao -->
+<chapter xml:id="configuration" xmlns="http://docbook.org/ns/docbook"
xmlns:xlink="http://www.w3.org/1999/xlink">
+ <title>运行时配置</title>
+
+ <sect1 xml:id="configuration.file">
+ <title>配置文件</title>
+
+ <simpara>
+ 配置文件(PHP 3 中是 <filename>php3.ini</filename>,自 PHP 4
+ 起是 &php.ini;)在 PHP 启动时被读取。对于服务器模块版本的 PHP,仅在 web
+ 服务器启动时读取一次。对于
+ <acronym>CGI</acronym> 和 <acronym>CLI</acronym> 版本,每次调用都会读
取。
+ </simpara>
+ <para>
+ &php.ini; 的搜索路径如下(按顺序):
+ <itemizedlist>
+ <listitem>
+ <para>
+ SAPI 模块所指定的位置(Apache 2 中的 <literal>PHPIniDir</literal>
+ 指令,CGI 和 CLI 中的 <literal>-c</literal>
+ 命令行选项,NSAPI 中的
+ <literal>php_ini</literal> 参数,THTTPD 中的
+ <literal>PHP_INI_PATH</literal> 环境变量)
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+
<literal>HKEY_LOCAL_MACHINE\SOFTWARE\PHP\IniFilePath</literal>(Windows 注册
表位置)
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <varname>PHPRC</varname> 环境变量
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ 当前工作目录(对于 CLI)
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ web 服务器目录(对于 SAPI 模块)或 PHP 所在目录(Windows 下其它情况)
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Windows 目录(<filename class="directory">C:\windows</filename>
+ 或 <filename class="directory">C:\winnt</filename>),或
+ <literal>--with-config-file-path</literal> 编译时选项指定的位置
+ </para>
+ </listitem>
+ </itemizedlist>
+ </para>
+ <para>
+ 如果存在 <filename>php-SAPI.ini</filename>(SAPI 是当前所用的 SAPI
+ 名称,因此实际文件名为 <filename>php-cli.ini</filename> 或
+ <filename>php-apache.ini</filename> 等),则会用它替代 &php.ini;。SAPI
+ 的名称可以用 <function>php_sapi_name</function> 来测定。
+ </para>
+ <note>
+ <para>
+ Apache web 服务器在启动时会把目录转到根目录,这将导致 PHP 尝试在根目录
下读取
+ &php.ini;,如果存在的话。
+ </para>
+ </note>
+ <para>
+ 由扩展库处理的 &php.ini; 指令,其文档分别在各扩展库的页面。<link
+ linkend="ini">内核配置选项</link>见附录。不过也许不是所有的 PHP
+ 指令都在手册中有文档说明。要得到自己的 PHP 版本中的配置指令完整列表,请
阅读
+ &php.ini; 文件,其中都有注释。此外,也许从 SVN 得到的<link
+ xlink:href="&url.php.svn.phpini;">最新版 &php.ini;</link> 也有帮助。
+ </para>
+ <para>
+ <example>
+ <title>&php.ini; 例子</title>
+ <programlisting role="ini">
+<![CDATA[
+; any text on a line after an unquoted semicolon (;) is ignored
+[php] ; section markers (text within square brackets) are also ignored
+; Boolean values can be set to either:
+; true, on, yes
+; or false, off, no, none
+register_globals = off
+track_errors = yes
+
+; you can enclose strings in double-quotes
+include_path = ".:/usr/local/lib/php"
+
+; backslashes are treated the same as any other character
+include_path = ".;c:\php\lib"
+]]>
+ </programlisting>
+ <!-- TODO: add more details about values and expressions -->
+ </example>
+ </para>
+ <para>
+ 自 PHP 5.1.0 起,有可能在 .ini 文件内引用已存在的 .ini
+ 变量。例如:<literal>open_basedir = ${open_basedir}
+ ":/new/dir"</literal>。
+ </para>
+ </sect1>
+
+
+ <sect1 xml:id="configuration.changes.modes">
+ <title>Where a configuration setting may be set</title>
+
+ <para>
+ These modes determine when and where a PHP directive may or may not
+ be set, and each directive within the manual refers to one of these
+ modes. For example, some settings may be set within a PHP script
+ using <function>ini_set</function>, whereas others may require
+ &php.ini; or &httpd.conf;.
+ </para>
+
+ <para>
+ For example, the
+ <link linkend="ini.output-buffering">output_buffering</link> setting
+ is <literal>PHP_INI_PERDIR</literal> therefore it may not be set using
+ <function>ini_set</function>. However, the
+ <link linkend="ini.display-errors">display_errors</link> directive is
+ <literal>PHP_INI_ALL</literal> therefore it may be set anywhere,
+ including with <function>ini_set</function>.
+ </para>
+
+ <para>
+ <table>
+ <title>Definition of PHP_INI_* modes</title>
+ <tgroup cols="3">
+ <thead>
+ <row>
+ <entry>Mode</entry>
+ <entry>Value</entry>
+ <entry>Meaning</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry><literal>PHP_INI_USER</literal></entry>
+ <entry>1</entry>
+ <entry>
+ Entry can be set in user scripts (like with
<function>ini_set</function>)
+ or in the <link linkend="configuration.changes.windows">Windows
registry</link>
+ </entry>
+ </row>
+ <row>
+ <entry><literal>PHP_INI_PERDIR</literal></entry>
+ <entry>6</entry>
+ <entry>Entry can be set in &php.ini;, &htaccess; or
&httpd.conf;</entry>
+ </row>
+ <row>
+ <entry><literal>PHP_INI_SYSTEM</literal></entry>
+ <entry>4</entry>
+ <entry>Entry can be set in &php.ini; or &httpd.conf;</entry>
+ </row>
+ <row>
+ <entry><literal>PHP_INI_ALL</literal></entry>
+ <entry>7</entry>
+ <entry>Entry can be set anywhere</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ </para>
+ </sect1>
+
+
+ <sect1 xml:id="configuration.changes">
+ <title>怎样修改配置设定</title>
+
+ <sect2 xml:id="configuration.changes.apache">
+ <title>PHP 运行于 Apache 模块方式</title>
+ <simpara>
+ 当使用 PHP 作为 Apache 模块时,也可以用 Apache
+ 的配置文件(例如 &httpd.conf;)和 &htaccess;
+ 文件中的指令来修改 PHP 的配置设定。需要有"AllowOverride
+ Options"或"AllowOverride All"权限才可以。
+ </simpara>
+
+ <para>
+ 在 PHP 4 和 PHP 5 中,有几个 Apache 指令可以使用户在 Apache
+ 配置文件内部修改 PHP 的配置。哪些指令属于
+ <constant>PHP_INI_ALL</constant>,<constant>PHP_INI_PERDIR</constant>
+ 或 <constant>PHP_INI_SYSTEM</constant> 中的哪一个,请参考附录中的
+ <link linkend="ini.list">php.ini 配置选项列表</link>。
+ </para>
+
+ <note>
+ <simpara>
+ 在 PHP 3 中,每个 <filename>php3.ini</filename> 中的配置设定都有相应的
+ Apache 指令,不过名字前要加上前缀"php3_"。
+ </simpara>
+ </note>
+
+ <para>
+ <variablelist>
+ <varlistentry>
+ <term>
+ <systemitem role="directive">php_value</systemitem>
+ <parameter>name</parameter>
+ <parameter>value</parameter>
+ </term>
+ <listitem>
+ <para>
+ 设定指定的值。只能用于
+ <constant>PHP_INI_ALL</constant> 或
<constant>PHP_INI_PERDIR</constant>
+ 类型的指令。要清除先前设定的值,把 value 设为
<literal>none</literal>。
+ </para>
+ <note>
+ <simpara>
+ 不要用 <systemitem role="directive">php_value</systemitem> 设定布
尔值。应该用
+ <systemitem role="directive">php_flag</systemitem>(见下面)。
+ </simpara>
+ </note>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
+ <systemitem role="directive">php_flag</systemitem>
+ <parameter>name</parameter>
+ <parameter>on|off</parameter>
+ </term>
+ <listitem>
+ <para>
+ 用来设定布尔值的配置指令。仅能用于
+ <constant>PHP_INI_ALL</constant> 和
+ <constant>PHP_INI_PERDIR</constant> 类型的指令。
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
+ <systemitem role="directive">php_admin_value</systemitem>
+ <parameter>name</parameter>
+ <parameter>value</parameter>
+ </term>
+ <listitem>
+ <para>
+ 设定指定的指令的值。<emphasis>不能用于</emphasis> &htaccess;
+ 文件。任何用 <systemitem
role="directive">php_admin_value</systemitem>
+ 设定的指令都不能被 &htaccess; 或 virtualhost
+ 中的指令覆盖。要清除先前设定的值,把 value 设为
<literal>none</literal>。
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
+ <systemitem role="directive">php_admin_flag</systemitem>
+ <parameter>name</parameter>
+ <parameter>on|off</parameter>
+ </term>
+ <listitem>
+ <para>
+ 用来设定布尔值的配置指令。<emphasis>不能用于</emphasis> &htaccess;
+ 文件。任何用 <systemitem
role="directive">php_admin_flag</systemitem>
+ 设定的指令都不能被 &htaccess; 或 virtualhost
+ 中的指令覆盖。
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </para>
+ <para>
+ <example>
+ <title>Apache 配置例子</title>
+ <programlisting role="ini">
+<![CDATA[
+<IfModule mod_php5.c>
+ php_value include_path ".:/usr/local/lib/php"
+ php_admin_flag safe_mode on
+</IfModule>
+<IfModule mod_php4.c>
+ php_value include_path ".:/usr/local/lib/php"
+ php_admin_flag safe_mode on
+</IfModule>
+<IfModule mod_php3.c>
+ php3_include_path ".:/usr/local/lib/php"
+ php3_safe_mode on
+</IfModule>
+]]>
+ </programlisting>
+ </example>
+ </para>
+ <caution>
+ <para>
+ PHP 常量不存在于 PHP 之外。例如在
+ &httpd.conf; 中不能使用 PHP 常量如
+ <constant>E_ALL</constant> 或 <constant>E_NOTICE</constant> 来设定
+ <link linkend="ini.error-reporting">error_reporting</link>
+ 指令,因为其无意义,实际等于
+ <emphasis>0</emphasis>。应该用相应的掩码值来替代。这些常量可以在
+ &php.ini; 中使用。
+ </para>
+ </caution>
+ </sect2>
+
+ <sect2 xml:id="configuration.changes.windows">
+ <title>通过 Windows 注册表修改 PHP 配置</title>
+ <simpara>
+ 在 Windows 下运行 PHP 时,可以用 Windows
+ 注册表以目录为单位来修改配置。配置值存放于注册表项
+ <literal>HKLM\SOFTWARE\PHP\Per Directory Values</literal>
+ 下面,子项对应于路径名。例如对于目录
+ <literal>c:\inetpub\wwwroot</literal> 的配置值会存放于
+ <literal>HKLM\SOFTWARE\PHP\Per Directory
Values\c\inetpub\wwwroot</literal>
+ 项下面。其中的设定对于任何位于此目录及其任何子目录的脚本都有效。项中的
值的名称是
+ PHP 配置指令的名字,值的数据是字符串格式的指令值。值中的 PHP
+ 常量不被解析。不过只有可修改范围是 PHP_INI_USER
+ 的配置值可以用此方法设定,PHP_INI_PERDIR 的值就不行。
+ </simpara>
+ </sect2>
+
+ <sect2 xml:id="configuration.changes.other">
+ <title>其它接口下的 PHP</title>
+ <para>
+ 无论怎样运行 PHP,都可以在脚本中通过 <function>ini_set</function>
+ 而在运行时修改某个值。更多信息见手册中
+ <function>ini_set</function> 的页面。
+ </para>
+ <para>
+ 如果对自己系统中的配置设定及其当前值的完整列表感兴趣,可以运行
+ <function>phpinfo</function> 函数并查看其结果的页面。也可以在运行时用
+ <function>ini_get</function> 或
+ <function>get_cfg_var</function> 取得个别配置指令的值。
+ </para>
+ </sect2>
+ </sect1>
+
+</chapter>
+
+<!-- Keep this comment at the end of the file
+Local variables:
+mode: sgml
+sgml-omittag:t
+sgml-shorttag:t
+sgml-minimize-attributes:nil
+sgml-always-quote-attributes:t
+sgml-indent-step:1
+sgml-indent-data:t
+indent-tabs-mode:nil
+sgml-parent-document:nil
+sgml-default-dtd-file:"~/.phpdoc/manual.ced"
+sgml-exposed-tags:nil
+sgml-local-catalogs:nil
+sgml-local-ecat-files:nil
+End:
+vim600: syn=xml fen fdm=syntax fdl=2 si
+vim: et tw=78 syn=sgml
+vi: ts=1 sw=1
+-->
=======================================
--- /dev/null
+++ /trunk/xml/install/pecl.xml Mon Apr 9 09:11:24 2012
@@ -0,0 +1,404 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- $Revision: 324974 $ -->
+<!-- EN-Revision: 315183 Maintainer: HonestQiao Status: ready -->
+<!-- Reviewed: no Maintainer: HonestQiao -->
+<chapter xml:id="install.pecl" xmlns="http://docbook.org/ns/docbook"
xmlns:xlink="http://www.w3.org/1999/xlink">
+ <title>PECL 扩展库安装</title>
+
+ <sect1 xml:id="install.pecl.intro">
+ <title>PECL 安装介绍</title>
+ <simpara>
+ <link xlink:href="&url.pecl;">PECL</link>
+ 是通过 <link xlink:href="&url.php.pear;">PEAR</link> 打包系统来的
+ PHP 扩展库仓库,本章内容示范了怎样取得并安装 PECL 扩展。
+ </simpara>
+ <simpara>
+ 以下指南中假定 <literal>/your/phpsrcdir/</literal> 是 PHP
+ 源程序的路径,<literal>extname</literal> 是 PECL
+ 扩展库的名字。自己根据实际情况调整。此外还假定用户熟悉
+ <link xlink:href="&url.php.pear.cli;">pear 命令</link>。
+ </simpara>
+ <simpara>
+ 要使用共享扩展库,必须经过编译,安装,然后加载。以下说明的方法提供了怎样
编译和安装扩展库德各种指导,但并不会自动加载它们。可以通过将其包括在
+ &php.ini; 中用
+ <link linkend="ini.extension">extension</link> PHP 指令加载,或者
+ 用 <function>dl</function> 函数。
+ </simpara>
+ <simpara>
+ 当编译 PHP 模块时,拥有各种工具(autoconf,automake,libtool
+ 等)的已知好使的版本很重要。所需工具和所需版本的详情见<link
+ xlink:href="&url.php.anonsvn;">匿名 SVN 说明</link>。
+ </simpara>
+ </sect1>
+
+ <sect1 xml:id="install.pecl.downloads">
+ <title>下载 PECL 扩展库</title>
+ <simpara>
+ 下载 PECL 扩展库有几种方法,如:
+ </simpara>
+ <itemizedlist>
+ <listitem>
+ <simpara>
+ <link xlink:href="&url.pecl;">&url.pecl;</link>
+ </simpara>
+ <simpara>
+ PECL 网站包括有 PHP
+ 开发组提供的不同扩展库的信息。这里的信息包括:更新记录,版本说明,需
求,以及其它信息。
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ <literal>pear download extname</literal>
+ </simpara>
+ <simpara>
+ PECL 网站中列出的 PECL 扩展库的发行版本可以用
+ <link xlink:href="&url.php.pear.cli;">pear
+ 命令</link>来下载和安装。也可以指明具体的修正版。
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ <acronym>SVN</acronym>
+ </simpara>
+ <simpara>
+ 大多数 PECL 扩展库也在 <acronym>SVN</acronym> 中。其 web 页面见
+ <link xlink:href="&url.php.svn;pecl/">&url.php.svn;pecl/</link>。要直
接从
+ <acronym>SVN</acronym> 中下载,用以下命令:
+ </simpara>
+ <para>
+ <screen>
+$ svn checkout http://svn.php.net/repository/pecl/extname/trunk extname
+ </screen>
+ </para>
+ </listitem>
+ <listitem>
+ <simpara>
+ Windows 下载
+ </simpara>
+ <simpara>
+ 目前PHP项目没有编译Windows下的二进制PECl扩展。要在
+ Windows 下编译 PHP,请阅读<link linkend="install.windows.building">有
关章节</link>。
+ </simpara>
+ </listitem>
+ </itemizedlist>
+ </sect1>
+ <sect1 xml:id="install.pecl.windows">
+ <title>Installing a PHP extension on Windows</title>
+ <para>
+ On Windows, you have two ways to load a PHP extension: either compile
it into PHP, or
+ load the DLL. Loading a pre-compiled extension is the easiest and
preferred way.
+ </para>
+ <para>
+ To load an extension, you need to have it available as a ".dll" file on
your system.
+ All the extensions are automatically and periodically compiled by the
PHP Group
+ (see next section for the download).
+ </para>
+ <para>
+ To compile an extension into PHP, please refer to <link
linkend="install.windows.building">
+ building from source</link> documentation.
+ </para>
+ <para>
+ To compile a standalone extension (aka a DLL file), please refer to
<link linkend="install.windows.building">
+ building from source</link> documentation. If the DLL file is available
neither with your
+ PHP distribution nor in PECL, you may have to compile it before you can
start using the
+ extension.
+ </para>
+
+ <sect2 xml:id="install.pecl.windows.find">
+ <title>Where to find an extension?</title>
+ <para>
+ PHP extensions are usually called "php_*.dll" (where the star
represents the name of
+ the extension) and they are located under the "PHP\ext"
("PHP\extensions" in PHP 4)
+ folder.
+ </para>
+ <para>
+ PHP ships with the extensions most useful to the majority of
developers. They are
+ called "core" extensions.
+ </para>
+ <para>
+ However, if you need functionality not provided by any core extension,
you may still be
+ able to find one in PECL. The PHP Extension Community Library (PECL)
is a repository for
+ PHP Extensions, providing a directory of all known extensions and
hosting facilities for
+ downloading and development of PHP extensions.
+ </para>
+ <para>
+ If you have developed an extension for your own uses, you might want
to think about hosting
+ it on PECL so that others with the same needs can benefit from your
time. A nice side effect
+ is that you give them a good chance to give you feedback, (hopefully)
thanks, bug reports
+ and even fixes/patches. Before you submit your extension for hosting
on PECL, please read
+ &url.pecl.submit;.
+ </para>
+ </sect2>
+
+ <sect2 xml:id="install.pecl.windows.which">
+ <title>Which extension to download?</title>
+ <para>
+ <emphasis>Many times, you will find several versions of each
DLL:</emphasis>
+ <itemizedlist>
+ <listitem>
+ <simpara>
+ Different version numbers (at least the first two numbers should
match)
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ Different thread safety settings
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ Different processor architecture (x86, x64, ...)
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ Different debugging settings
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ <literal>etc.</literal>
+ </simpara>
+ </listitem>
+ </itemizedlist>
+ </para>
+ <para>
+ You should keep in mind that your extension settings should match all
the
+ settings of the PHP executable you are using. The following PHP script
will
+ tell you <emphasis>all</emphasis> about your PHP settings:
+ </para>
+ <para>
+ <example>
+ <title><function>phpinfo</function> call</title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+phpinfo();
+?>
+]]>
+ </programlisting>
+ </example>
+ </para>
+ <para>
+ Or from the command line, run:
+ <screen>
+<![CDATA[
+drive:\\path\to\php\executable\php.exe -i
+]]>
+ </screen>
+ </para>
+ </sect2>
+
+ <sect2 xml:id="install.pecl.windows.loading">
+ <title>Loading an extension</title>
+ <para>
+ The most common way to load a PHP extension is to include it in your
<filename>php.ini</filename>
+ configuration file. Please note that many extensions are already
present in your
+ <filename>php.ini</filename> and that you only need to remove the
semicolon to activate them.
+ <screen>
+<![CDATA[
+;extension=php_extname.dll
+]]>
+ </screen>
+ <screen>
+<![CDATA[
+extension=php_extname.dll
+]]>
+ </screen>
+ </para>
+ <para>
+ However, some web servers are confusing because they do not use the
<filename>php.ini</filename> located alongside
+ your PHP executable. To find out where your actual
<filename>php.ini</filename> resides, look
+ for its path in <function>phpinfo</function>:
+ <screen>
+<![CDATA[
+Configuration File (php.ini) Path C:\WINDOWS
+]]>
+ </screen>
+ <screen>
+<![CDATA[
+Loaded Configuration File C:\Program Files\PHP\5.2\php.ini
+]]>
+ </screen>
+ </para>
+ <para>
+ After activating an extension, save <filename>php.ini</filename>,
restart the web server and check
+ <function>phpinfo</function> again. The new extension should now have
its own section.
+ </para>
+ </sect2>
+
+ <sect2 xml:id="install.pecl.windows.problemsolving">
+ <title>Resolving problems</title>
+ <para>
+ If the extension does not appear in <function>phpinfo</function>, you
should check your logs to
+ learn where the problem comes from.
+ </para>
+ <para>
+ If you are using PHP from the command line (CLI), the extension
loading error can be read
+ directly on screen.
+ </para>
+ <para>
+ If you are using PHP with a web server, the location and format of the
logs vary depending on
+ your software. Please read your web server documentation to locate the
logs, as it does not
+ have anything to do with PHP itself.
+ </para>
+ <para>
+ Common problems are the location of the DLL, the value of the "<link
linkend="ini.extension-dir">
+ extension_dir</link>" setting inside <filename>php.ini</filename> and
compile-time setting mismatches.
+ </para>
+ <para>
+ If the problem lies in a compile-time setting mismatch, you probably
didn't download the right DLL.
+ Try downloading again the extension with the right settings. Again,
<function>phpinfo</function>
+ can be of great help.
+ </para>
+ </sect2>
+
+ </sect1>
+
+ <sect1 xml:id="install.pecl.pear">
+ <title>用 PEAR 编译共享 PECL 扩展库</title>
+ <simpara>
+ PEAR 使建立共享 PHP 扩展库更容易。用
+ <link xlink:href="&url.php.pear.cli;">pear 命令</link>这样做:
+ </simpara>
+ <para>
+ <screen>
+$ pear install extname
+ </screen>
+ </para>
+ <simpara>
+ 这将下载 <emphasis>extname</emphasis> 的源代码,编译之,并将
+ <filename>extname.so</filename> 安装到 <link
+ linkend="ini.extension-dir">extension_dir</link>
+ 中。然后 <filename>extname.so</filename> 就可以通过 &php.ini; 加载了。
+ </simpara>
+ <simpara>
+ 默认情况下,<literal>pear</literal> 命令不会安装标记为
+ <literal>alpha</literal> 或
+ <literal>beta</literal> 状态的包。如果没有 <literal>stable</literal>
+ 包可用,也可以用以下命令安装一个 <literal>beta</literal> 包:
+ </simpara>
+ <para>
+ <screen>
+$ pear install extname-beta
+ </screen>
+ </para>
+ <para>
+ 也可以用此命令安装一个指定的版本:
+ </para>
+ <para>
+ <screen>
+$ pear install extname-0.1
+ </screen>
+ </para>
+ </sect1>
+
+ <sect1 xml:id="install.pecl.phpize">
+ <title>用 phpize 编译共享 PECL 扩展库</title>
+ <simpara>
+ 有时候不能用 <literal>pear</literal>
+ 安装命令。这可能是因为在防火墙后面,或者是因为想要安装的扩展库还没有
+ PEAR 兼容的包,例如 SVN 中尚未发布的扩展库。如果要编译这种扩展库,可以用
更底层的编译工具来手工进行编译。
+ </simpara>
+ <simpara>
+ <literal>phpize</literal> 命令是用来准备 PHP
+ 扩展库的编译环境的。下面例子中,扩展库的源程序位于
+ <filename>extname</filename> 目录中:
+ </simpara>
+ <para>
+ <screen>
+<![CDATA[
+$ cd extname
+$ phpize
+$ ./configure
+$ make
+# make install
+]]>
+ </screen>
+ </para>
+ <simpara>
+ 成功的安装将创建 <filename>extname.so</filename> 并放置于
+ PHP 的<link linkend="ini.extension-dir">扩展库目录</link>中。需要调整
+ &php.ini;,加入 <literal>extension=extname.so</literal>
+ 这一行之后才能使用此扩展库。
+ </simpara>
+ </sect1>
+
+ <sect1 xml:id="install.pecl.static">
+ <title>将 PECL 扩展库静态编译入 PHP</title>
+ <simpara>
+ 有时可能需要将扩展库静态编译到 PHP 中。这需要将扩展库源程序放入
+ <filename>php-src/ext/</filename> 目录中去并告诉 PHP
+ 编译系统来生成其配置脚本。
+ </simpara>
+ <para>
+ <screen>
+<![CDATA[
+$ cd /your/phpsrcdir/ext
+$ pear download extname
+$ gzip -d < extname.tgz | tar -xvf -
+$ mv extname-x.x.x extname
+]]>
+ </screen>
+ </para>
+ <simpara>
+ 这将产生以下目录:
+ </simpara>
+ <para>
+ <screen>
+ /your/phpsrcdir/ext/extname
+ </screen>
+ </para>
+ <simpara>
+ 此时强制 PHP 重新生成配置脚本,然后正常编译 PHP:
+ </simpara>
+ <para>
+ <screen>
+$ cd /your/phpsrcdir
+$ rm configure
+$ ./buildconf --force
+$ ./configure --help
+$ ./configure --with-extname --enable-someotherext --with-foobar
+$ make
+$ make install
+ </screen>
+ </para>
+ <note>
+ <simpara>
+ 要运行"buildconf"脚本,需要 autoconf 2.13 和 automake 1.4+(更新版本的
+ autoconf 也许能工作,但不被支持)。
+ </simpara>
+ </note>
+ <simpara>
+ 是否用 <literal>--enable-extname</literal> 或
<literal>--with-extname</literal>
+ 取决于扩展库。通常不需要外部库文件的扩展库使用
+ <literal>--enable</literal>。要确认的话,在 buildconf 之后运行:
+ </simpara>
+ <para>
+ <screen>
+$ ./configure --help | grep extname
+ </screen>
+ </para>
+ </sect1>
+</chapter>
+
+<!-- Keep this comment at the end of the file
+Local variables:
+mode: sgml
+sgml-omittag:t
+sgml-shorttag:t
+sgml-minimize-attributes:nil
+sgml-always-quote-attributes:t
+sgml-indent-step:1
+sgml-indent-data:t
+indent-tabs-mode:nil
+sgml-parent-document:nil
+sgml-default-dtd-file:"~/.phpdoc/manual.ced"
+sgml-exposed-tags:nil
+sgml-local-catalogs:nil
+sgml-local-ecat-files:nil
+End:
+vim600: syn=xml fen fdm=syntax fdl=2 si
+vim: et tw=78 syn=sgml
+vi: ts=1 sw=1
+-->
=======================================
--- /dev/null
+++ /trunk/xml/install/unix/apache1.xml Mon Apr 9 09:11:24 2012
@@ -0,0 +1,232 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- $Revision: 324974 $ -->
+<!-- EN-Revision: 299643 Maintainer: HonestQiao Status: ready -->
+<!-- Reviewed: no Maintainer: HonestQiao -->
+<!-- $EN-Revision: 299643 $ -->
+<sect1 xml:id="install.unix.apache"
+ xmlns="http://docbook.org/ns/docbook"
+ xmlns:xlink="http://www.w3.org/1999/xlink">
+ <title>Unix 系统下的 Apache 1.3.x</title>
+ <para>本节包括在 Unix 平台的 Apache 下安装 PHP 的说明和提示。我们在另外的
页面也有
+ <link linkend="install.unix.apache2">Apache 2 的安装和说明</link>。
</para>
+ <para>可以从
+ <link linkend="configure">核心配置选项列表</link>以及位于手册对应部分的特
定扩展配置选项中选择参数并在安装步骤第 10 步将它们添加到
+ <command>configure</command>命令中。版本号在这里被省略了以保证此说明的正
确性。需要将这里的"xxx"替换为自己使用的文件的正确值。</para>
+ <example xml:id="install.unix.apache.example">
+ <title>PHP 的 Apache 共享模块版本安装说明</title>
+ <screen>
+ <![CDATA[
+1. gunzip apache_xxx.tar.gz
+2. tar -xvf apache_xxx.tar
+3. gunzip php-xxx.tar.gz
+4. tar -xvf php-xxx.tar
+5. cd apache_xxx
+6. ./configure --prefix=/www --enable-module=so
+7. make
+8. make install
+9. cd ../php-xxx
+10. 现在,配置 PHP。这是定制 PHP 的不同选项的时候,例如要加载哪些扩展库。使

+ ./configure --help
+ 来列出可用的选项。在下面的示例中只是简单地配置 Apache 1 和 MySQL 支持。
+ 用户的 apxs 的路径可能和此示例中的不同。
+ ./configure --with-mysql --with-apxs=/www/bin/apxs
+11. make
+12. make install
+ 如果在安装之后决定修改配置选项,那么只需重复以上最后三步。只须重新启动
+ Apache 就可以使新模块生效。不需要重新编译 Apache。注意除非特别指出,
+ "make install"总是会安装 PEAR,各种 PHP 工具例如 phpize,PHP CLI 以及其
它。
+13. 建立 php.ini 文件。
+ cp php.ini-dist /usr/local/lib/php.ini
+ 可以编辑 php.ini 来设置 PHP 选项。如果想把 php.ini 放在其它目录,在第
+ 10 步加上以下选项:
+ --with-config-file-path=/path
+ 如果选择了 php.ini-recommended,确保阅读一下其中的变更说明,因为这些会
+ 影响到 PHP 的行为。
+14. 编辑 httpd.conf 来加载 PHP 模块。在 LoadModule 语句右边的路径必须指向系
统中
+ PHP 模块所在的路径。上面的 make install 步骤可能已经添加了,但还是检查
确认一下。
+ 对 PHP 4:
+ LoadModule php4_module libexec/libphp4.so
+ 对 PHP 5:
+ LoadModule php5_module libexec/libphp5.so
+15. 在 httpd.conf 中加入 AddModule 部分,在 ClearModuleList 下面的某处,加
上这一句:
+ 对 PHP 4:
+ AddModule mod_php4.c
+ 对 PHP 5:
+ AddModule mod_php5.c
+16. 告诉 Apache 将哪些后缀作为 PHP 解析。例如,让 Apache 把 .php 后缀的文件
解析为
+ PHP。可以将任何后缀的文件解析为 PHP,只要在以下语句中加入并用空格分开。
这里以
+ 添加一个 .phtml 来示例。
+ AddType application/x-httpd-php .php .phtml
+ 为了将 .phps 作为 PHP 的源文件进行语法高亮显示,还可以加上:
+ AddType application/x-httpd-php-source .phps
+17. 用通常的过程启动 Apache(必须完全停止 Apache 再重新启动,而不是用 HUP
或者
+ USR1 信号使 Apache 重新加载)。
+]]>
+</screen>
+ </example>
+ <para>也可以将 PHP 作为静态对象来安装:</para>
+ <example xml:id="install.unix.apache.example-static">
+ <title>PHP 的 Apache 静态模块版本安装说明</title>
+ <screen>
+ <![CDATA[
+1. gunzip -c apache_1.3.x.tar.gz | tar xf -
+2. cd apache_1.3.x
+3. ./configure
+4. cd ..
+
+5. gunzip -c php-5.x.y.tar.gz | tar xf -
+6. cd php-5.x.y
+7. ./configure --with-mysql --with-apache=../apache_1.3.x
+8. make
+9. make install
+
+10. cd ../apache_1.3.x
+
+11. ./configure --prefix=/www --activate-module=src/modules/php5/libphp5.a
+ (上面一行是正确的!是的,我们知道 libphp5.a 尚不存在,还不到时候,
+ 它会在之后被创建。)
+
+12. make
+ (现在应该有一个 httpd 二进制文件,可以将它复制到 Apache bin 目录。如果
这是
+ 第一次安装,还要"make install"。)
+
+13. cd ../php-5.x.y
+14. cp php.ini-dist /usr/local/lib/php.ini
+
+15. 可以编辑 /usr/local/lib/php.ini 文件以设置 PHP 选项。编辑 httpd.conf 或
+ srm.conf 文件,添加:
+ AddType application/x-httpd-php .php
+]]>
+</screen>
+ </example>
+ <note>
+ <para>对于 PHP 4,把
+ <literal>php-5</literal>换成
+ <literal>php-4</literal>,把
+ <literal>php5</literal>换成
+ <literal>php4</literal>。</para>
+ </note>
+ <para>根据 Unix 系统和 Apache 安装方法的不同,有很多方法停止和重启动
Apache。以下是一些不同的 Apache/UNIX 下重启动 Apache 的典型命令。需要把
+ <literal>/path/to/</literal>替换成自己系统上的确切路径。</para>
+ <para>
+ <example>
+ <title>重启动 Apache 的示例命令</title>
+ <programlisting role="shell">
+ <![CDATA[
+1. 在一些 Linux 和 SysV 的变种下:
+/etc/rc.d/init.d/httpd restart
+
+2. 使用 apachectl 脚本:
+/path/to/apachectl stop
+/path/to/apachectl start
+
+3. httpdctl 和 httpsdctl(使用了 OpenSSL),类似 apachectl:
+/path/to/httpsdctl stop
+/path/to/httpsdctl start
+
+4. 使用了 mod_ssl,或其他 SSL 服务器,可能需要手工重启动:
+/path/to/apachectl stop
+/path/to/apachectl startssl
+]]>
+</programlisting>
+ </example>
+ </para>
+ <para>apachectl 和 http(s)dctl 程序所在的路径在不同系统中通常不一样。如果
系统中有
+ <literal>locate</literal>或者
+ <literal>whereis</literal>或者
+ <literal>which</literal>命令,那么可以帮助找到这些控制程序。</para>
+ <para>编译 PHP 和 Apache 的不同例子还有:
+ <informalexample>
+ <programlisting role="shell">
+ <![CDATA[
+./configure --with-apxs --with-pgsql
+]]>
+</programlisting>
+ </informalexample></para>
+ <para>此配置将生成在 Apache 的 &httpd.conf; 文件中用 LoadModule 加载的
+ <filename>libphp5.so</filename>共享库(PHP 4 是
+ <filename>libphp4.so</filename>)。而 PostgreSQL 支持将嵌入到此共享库中。
</para>
+ <para>
+ <informalexample>
+ <programlisting role="shell">
+ <![CDATA[
+./configure --with-apxs --with-pgsql=shared
+]]>
+</programlisting>
+ </informalexample>
+ </para>
+ <para>此配置将生成 Apache 的
+ <filename>libphp5.so</filename>共享库,并且还生成
+ <filename>pgsql.so</filename>共享库,可以在 &php.ini; 文件中用 extension
指令加载,或者在 PHP 脚本中用
+ <function>dl</function>函数明确地加载。</para>
+ <para>
+ <informalexample>
+ <programlisting role="shell">
+ <![CDATA[
+./configure --with-apache=/path/to/apache_source --with-pgsql
+]]>
+</programlisting>
+ </informalexample>
+ </para>
+ <para>此配置将生成
+ <filename>libmodphp5.a</filename>库,
+ <filename>mod_php5.c</filename>和一些相关的文件并且拷贝到 Apache 源程序目
录中的
+ <literal>src/modules/php5</literal>目录下。然后用
+ <literal>--activate-module=src/modules/php5/libphp5.a</literal>编译
Apache,Apache 编译系统会生成
+ <filename>libphp5.a</filename>并且将其静态地连接到
+ <filename>httpd</filename>程序中(在 PHP 4 中把
+ <literal>php5</literal>替换成
+ <literal>php4</literal>)。PostgreSQL 支持也直接包括在这个
+ <filename>httpd</filename>程序中了,因此最终结果是单一的一个包括了所有
Apache 和 PHP 支持的
+ <filename>httpd</filename>可执行文件。</para>
+ <para>
+ <informalexample>
+ <programlisting role="shell">
+ <![CDATA[
+./configure --with-apache=/path/to/apache_source --with-pgsql=shared
+]]>
+</programlisting>
+ </informalexample>
+ </para>
+ <para>此配置和上面一样----除了没有在最后的
+ <filename>httpd</filename>可执行文件中包括 PostgreSQL 的支持以及生成了一

+ <filename>pgsql.so</filename>共享库以外。该共享库可以在 &php.ini; 文件中
或者用
+ <function>dl</function>函数加载。</para>
+ <para>当选择不同的方法编译 PHP 时,需要考虑每种方法的优势和缺点。用共享对
象方式编译 PHP 意味着可以单独编译 Apache,并且不用在添加或修改了 PHP 的时候
重新编译所有程序。用内置方法编译 PHP(静态方式)意味着 PHP 可以加载和运行得
更快。更多信息见 Apache 的
+ <link xlink:href="&url.apachedso;">DSO 支持页面</link>。</para>
+ <note>
+ <para>Apache 默认的 &httpd.conf; 文件中目前包括类似如下的内容:
+ <informalexample>
+ <programlisting role="apache-conf">
+ <![CDATA[
+User nobody
+Group "#-1"
+]]>
+</programlisting>
+ </informalexample>除非把它修改成"Group nogroup"或者其它类似的("Group
daemon"也很通用),PHP 将不能打开文件。</para>
+ </note>
+ <note>
+ <para>确认在使用
+ <option role="configure">--with-apxs=/path/to/apxs</option>时指向
Apache 安装后的目录中的 apxs。绝对不能用 Apache 源程序中的 apxs 而要用安装后
的 apxs。</para>
+ </note>
+</sect1>
+<!-- Keep this comment at the end of the file
+Local variables:
+mode: sgml
+sgml-omittag:t
+sgml-shorttag:t
+sgml-minimize-attributes:nil
+sgml-always-quote-attributes:t
+sgml-indent-step:1
+sgml-indent-data:t
+indent-tabs-mode:nil
+sgml-parent-document:nil
+sgml-default-dtd-file:"~/.phpdoc/manual.ced"
+sgml-exposed-tags:nil
+sgml-local-catalogs:nil
+sgml-local-ecat-files:nil
+End:
+vim600: syn=xml fen fdm=syntax fdl=2 si
+vim: et tw=78 syn=sgml
+vi: ts=1 sw=1
+-->
=======================================
--- /dev/null
+++ /trunk/xml/install/unix/commandline.xml Mon Apr 9 09:11:24 2012
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- $Revision: 324974 $ -->
+<!-- EN-Revision: 306096 Maintainer: HonestQiao Status: ready -->
+<!-- Reviewed: no Maintainer: HonestQiao -->
+<!-- $EN-Revision: 299643 $ -->
+<sect1 xml:id="install.unix.commandline"
+ xmlns="http://docbook.org/ns/docbook"
+ xmlns:xlink="http://www.w3.org/1999/xlink">
+<title>CGI 和命令行设置</title>
+<para>默认为将 PHP 编译为 <acronym>CLI</acronym> 和 <acronym>CGI</acronym>
程序。这将建立一个命令行解释器,可用于 CGI 处理或非 web 相关的 PHP 脚本。如
果用户运行着一个 PHP 模块支持的 web 服务器,那通常为性能考虑应该使用模块方
式。不过,CGI 版可以使 Apache 用户用不同的用户 ID 运行不同的 PHP 页面。
</para>
+&warn.install.cgi;
+<sect2 xml:id="install.unix.commandline.testing">
+ <title>测试</title>
+ <simpara>如果将 PHP 编译为 CGI 程序,可以通过键入
+ <command>make test</command>来测试你的编译。测试一下编译永远是个好主意。
这样就可以在你的平台上及早捕捉到 PHP 的问题而不是以后再费力的解决。
</simpara>
+</sect2>
+<sect2 xml:id="install.unix.commandline.using-variables">
+ <title>使用变量</title>
+ <simpara>某些
+ <link linkend="reserved.variables.server">服务器提供的环境变量</link>没有
定义在当前的
+ <link xlink:href="&url.rfc;3875">CGI/1.1 标准</link>中。只有下列变量定义
在其中:
+ <varname>AUTH_TYPE</varname>,
+ <varname>CONTENT_LENGTH</varname>, <varname>CONTENT_TYPE</varname>,
+ <varname>GATEWAY_INTERFACE</varname>, <varname>PATH_INFO</varname>,
+ <varname>PATH_TRANSLATED</varname>, <varname>QUERY_STRING</varname>,
+ <varname>REMOTE_ADDR</varname>, <varname>REMOTE_HOST</varname>,
+ <varname>REMOTE_IDENT</varname>, <varname>REMOTE_USER</varname>,
+ <varname>REQUEST_METHOD</varname>, <varname>SCRIPT_NAME</varname>,
+ <varname>SERVER_NAME</varname>, <varname>SERVER_PORT</varname>,
+ <varname>SERVER_PROTOCOL</varname>, 和
<varname>SERVER_SOFTWARE</varname>.
+ 其它的变量均作为"供应商扩展(vendor extensions)"来对待。
+ </simpara>
+ </sect2>
+ </sect1>
+<!-- Keep this comment at the end of the file
+Local variables:
+mode: sgml
+sgml-omittag:t
+sgml-shorttag:t
+sgml-minimize-attributes:nil
+sgml-always-quote-attributes:t
+sgml-indent-step:1
+sgml-indent-data:t
+indent-tabs-mode:nil
+sgml-parent-document:nil
+sgml-default-dtd-file:"~/.phpdoc/manual.ced"
+sgml-exposed-tags:nil
+sgml-local-catalogs:nil
+sgml-local-ecat-files:nil
+End:
+vim600: syn=xml fen fdm=syntax fdl=2 si
+vim: et tw=78 syn=sgml
+vi: ts=1 sw=1
+-->
=======================================
--- /dev/null
+++ /trunk/xml/install/unix/debian.xml Mon Apr 9 09:11:24 2012
@@ -0,0 +1,129 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- $Revision: 324974 $ -->
+<!-- EN-Revision: 299778 Maintainer: HonestQiao Status: ready -->
+<!-- Reviewed: no Maintainer: HonestQiao -->
+<!-- $EN-Revision: 299778 $ -->
+<sect1 xml:id="install.unix.debian"
+ xmlns="http://docbook.org/ns/docbook"
+ xmlns:xlink="http://www.w3.org/1999/xlink">
+ <title>Debian GNU/Linux 安装说明</title>
+ <para>本节包含了在
+ <link xlink:href="&url.debian;">Debian GNU/Linux</link>下安装 PHP 的说明
和提示。</para>
+ <warning>
+ <para>Unofficial builds from third-parties are not supported here. Any
bugs should be reported to the Debian team unless they can be reproduced
using the latest builds from our
+ <link xlink:href="&url.php.downloads;">download area</link>.</para>
+ </warning>
+ <para>While the instructions for building PHP on Unix apply to Debian as
well, this manual page contains specific information for other options,
such as using either the
+ <literal>apt-get</literal>or
+ <literal>aptitude</literal>commands. This manual page uses these two
commands interchangeably.</para>
+ <sect2 xml:id="install.unix.debian.apt">
+ <title>使用 APT</title>
+ <simpara>
+ First, note that other related packages may be desired like
+ <literal>libapache2-mod-php5</literal> to integrate with Apache 2, and
+ <literal>php-pear</literal> for PEAR.
+ </simpara>
+ <simpara>
+ Second, before installing a package, it's wise to ensure the package
list
+ is up to date. Typically, this is done by running the command
+ <command>apt-get update</command>.
+ </simpara>
+ <example xml:id="install.unix.debian.apt.example">
+ <title>Debian 中在 Apache 2 下安装的例子</title>
+ <programlisting role="shell">
+ <![CDATA[
+# apt-get install php5-common libapache2-mod-php5 php5-cli
+]]>
+</programlisting>
+ </example>
+ <simpara>APT 将自动安装 Apache 2 的 PHP 5 模块以及所有依赖的库并激活
之。如果在安装过程中没有被要求重启动 Apache,那必须手工进行:</simpara>
+ <example xml:id="install.unix.debian.apt.example2">
+ <title>安装完 PHP 后停止并启动 Apache</title>
+ <programlisting role="shell">
+ <![CDATA[
+# /etc/init.d/apache2 stop
+# /etc/init.d/apache2 start
+]]>
+</programlisting>
+ </example>
+ </sect2>
+ <sect2 xml:id="install.unix.debian.config">
+ <title>更好地控制配置</title>
+ <simpara>上一节中 PHP 仅安装了核心模块。但可能不够用,用户很快就会发现
需要更多的激活模块,例如 MySQL,cURL,GD 等。</simpara>
+ <simpara>当自己从源代码编译 PHP 时,需要通过
+ <command>configure</command>命令来激活模块。用 APT 则只需安装附加的软件
包。这些包都命名为"php4-*"(或"php5-*",如果安装了第三方的 PHP 5 的话)。
</simpara>
+ <example xml:id="install.unix.debian.config.example">
+ <title>取得 PHP 附加软件包的列表</title>
+ <programlisting role="shell">
+ <![CDATA[
+# dpkg -l 'php4-*'
+]]>
+</programlisting>
+ </example>
+ <simpara>从上面的输出中可以看到,还有很多 PHP 模块可安装(除了
php4-cgi,php4-cli 或 php4-pear 这些特殊软件包)。仔细察看并安装自己所需要
的。如果选择了一个模块而没有相应的库,APT 会自动安装所有依赖的库。</simpara>
+ <simpara>如果选择将 MySQL,cURL 和 GD 支持添加到 PHP 中,则其命令类似
于:</simpara>
+ <example xml:id="install.unix.debian.config.example2">
+ <title>安装 PHP 的 MySQL,cURL 和 GD 支持</title>
+ <programlisting role="shell">
+ <![CDATA[
+# apt-get install php4-mysql php4-curl php4-gd
+]]>
+</programlisting>
+ </example>
+ <simpara>APT 会自动把适当的行添加到不同的 &php.ini;(
+ <filename>/etc/php4/apache/php.ini</filename>,
+ <filename>/etc/php4/cgi/php.ini</filename>等)中去。</simpara>
+ <example xml:id="install.unix.debian.config.example3">
+ <title>在 PHP 中激活 MySQL,cURL 和 GD 的配置行</title>
+ <programlisting role="shell">
+ <![CDATA[
+extension=mysql.so
+extension=curl.so
+extension=gd.so
+]]>
+</programlisting>
+ </example>
+ <simpara>只需像之前那样重新启动 Apache 来激活这些模块。</simpara>
+ </sect2>
+ <sect2 xml:id="install.unix.debian.faq">
+ <title>常见问题</title>
+ <itemizedlist>
+ <listitem>
+ <simpara>如果看到了 PHP 源代码而不是脚本应该产生的结果,则 APT 可能
没有
+ <filename>/etc/apache/conf.d/php4</filename>包括到 Apache 1.3 配置
中去。请确保下面一行出现在
+ <filename>/etc/apache/httpd.conf</filename>文件中并重启动
Apache:</simpara>
+ <example xml:id="install.unix.debian.faq.example">
+ <title>下面这行在 Apache 中激活了 PHP 4</title>
+ <programlisting role="shell">
+ <![CDATA[
+# Include /etc/apache/conf.d/
+]]>
+</programlisting>
+ </example>
+ </listitem>
+ <listitem>
+ <simpara>如果安装了更多模块但其函数不能在脚本中使用,请确保相应的配
置行出现在 &php.ini; 中,如上面所说。APT 可能会由于混乱的 debconf 配置而在安
装附加模块时失败。</simpara>
+ </listitem>
+ </itemizedlist>
+ </sect2>
+</sect1>
+<!-- Keep this comment at the end of the file
+Local variables:
+mode: sgml
+sgml-omittag:t
+sgml-shorttag:t
+sgml-minimize-attributes:nil
+sgml-always-quote-attributes:t
+sgml-indent-step:1
+sgml-indent-data:t
+indent-tabs-mode:nil
+sgml-parent-document:nil
+sgml-default-dtd-file:"~/.phpdoc/manual.ced"
+sgml-exposed-tags:nil
+sgml-local-catalogs:nil
+sgml-local-ecat-files:nil
+End:
+vim600: syn=xml fen fdm=syntax fdl=2 si
+vim: et tw=78 syn=sgml
+vi: ts=1 sw=1
+-->
=======================================
--- /dev/null
+++ /trunk/xml/install/windows/building.xml Mon Apr 9 09:11:24 2012
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- $Revision: 324974 $ -->
+<!-- EN-Revision: 298671 Maintainer: HonestQiao Status: ready -->
+<!-- Reviewed: no Maintainer: HonestQiao -->
+<sect1 xml:id="install.windows.building"
xmlns="http://docbook.org/ns/docbook"
xmlns:xlink="http://www.w3.org/1999/xlink">
+ <title>从源程序编译</title>
+ <para>
+ 本章讲述了在 Windows 下如何使用 Microsoft 的工具编译 PHP。要在
+ CygWin 中编译 PHP,请参考 <link linkend="install.unix">Unix 系统下的安装
</link>一章。
+ </para>
+ <para>
+ See the Wiki documentation at:
+ <link
xlink:href="&url.wiki.windows.build.howto;">&url.wiki.windows.build.howto;</link>
+ </para>
+</sect1>
+
+<!-- Keep this comment at the end of the file
+Local variables:
+mode: sgml
+sgml-omittag:t
+sgml-shorttag:t
+sgml-minimize-attributes:nil
+sgml-always-quote-attributes:t
+sgml-indent-step:1
+sgml-indent-data:t
+indent-tabs-mode:nil
+sgml-parent-document:nil
+sgml-default-dtd-file:"~/.phpdoc/manual.ced"
+sgml-exposed-tags:nil
+sgml-local-catalogs:nil
+sgml-local-ecat-files:nil
+End:
+vim600: syn=xml fen fdm=syntax fdl=2 si
+vim: et tw=78 syn=sgml
+vi: ts=1 sw=1
+-->
=======================================
--- /dev/null
+++ /trunk/xml/install/windows/extensions.xml Mon Apr 9 09:11:24 2012
@@ -0,0 +1,496 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- $Revision: 324974 $ -->
+<!-- EN-Revision: 297028 Maintainer: HonestQiao Status: ready -->
+<!-- Reviewed: no Maintainer: HonestQiao -->
+<!-- $EN-Revision: 297028 $ -->
+<sect1 xml:id="install.windows.extensions"
+ xmlns="http://docbook.org/ns/docbook">
+ <title>Windows 下安装扩展库</title>
+ <para>在 Windows 下安装完 PHP 和 web 服务器之后,可能想要安装一些扩展库来
获得更多功能。可以通过修改 &php.ini; 来选择当 PHP 启动时加载哪些扩展库。也可
以在脚本中通过使用
+ <function>dl</function>来动态加载。</para>
+ <para>PHP 扩展库的 DLL 文件都具有
+ <literal>php_</literal>前缀。</para>
+ <para>很多扩展库都
+ <emphasis>内置于</emphasis>Windows 版的 PHP 之中。这意味着要加载这些扩展

+ <emphasis>不需要</emphasis>额外的 DLL 文件和
+ <link linkend="ini.extension">extension</link>配置指令。Windows 下的
+ <link linkend="install.windows.extensions.overview">PHP 扩展库</link>列表
列出了需要或曾经需要额外 PHP DLL 文件的扩展库。下面是内置的扩展库列
表:</para>
+ <para>PHP 4 中(截止到 PHP 4.3.11):
+ <link linkend="ref.bc">BCMath</link>,
+ <link linkend="ref.calendar">Caledar</link>,
+ <link linkend="ref.com">COM</link>,
+ <link linkend="ref.ctype">Ctype</link>,
+ <link linkend="ref.ftp">FTP</link>,
+ <link linkend="ref.mysql">MySQL</link>,
+ <link linkend="ref.uodbc">ODBC</link>,
+ <link linkend="ref.overload">Overload</link>,
+ <link linkend="ref.pcre">PCRE</link>,
+ <link linkend="ref.session">Session</link>,
+ <link linkend="ref.tokenizer">Tokenizer</link>,
+ <link linkend="ref.wddx">WDDX</link>,
+ <link linkend="ref.xml">XML</link>&listendand; ,
+ <link linkend="ref.zlib">Zlib</link>。</para>
+ <para>PHP 5 中(截止到 5.0.4)有以下修改。新增内置:
+ <link linkend="ref.dom">DOM</link>,
+ <link linkend="ref.libxml">LibXML</link>,
+ <link linkend="ref.iconv">Iconv</link>,
+ <link linkend="ref.simplexml">SimpleXML</link>,
+ <link linkend="ref.spl">SPL</link>&listendand; ,
+ <link linkend="ref.sqlite">SQLite</link>。以下不再内置:
+ <link linkend="ref.mysql">MySQL</link>和
+ <link linkend="ref.overload">Overload</link>。</para>
+ <para>PHP 搜索扩展库的默认位置在 PHP 4 中是
+ <filename class="directory">C:\php4\extensions</filename>,在 PHP 5 中是
+ <filename class="directory">C:\php5</filename>。要修改此项以符合用户自己
的 PHP 设置,需要编辑 &php.ini; 文件:
+ <itemizedlist>
+ <listitem>
+ <para>需要修改
+ <link linkend="ini.extension-dir">extension_dir</link>设置以指向用户
放置扩展库的目录或者说放置
+ <filename>php_*.dll</filename>文件的位置。例如:
+ <informalexample>
+ <programlisting role="ini">
+ <![CDATA[
+extension_dir = C:\php\extensions
+]]>
+</programlisting>
+ </informalexample></para>
+ </listitem>
+ <listitem>
+ <para>要在 &php.ini; 中启用某扩展库,需要去掉该行
+ <literal>extension=php_*.dll</literal>前的注释符号,将想要加载的扩展
库前的分号(;)删除即可。
+ <example>
+ <title>启用
+ <link linkend="ref.bzip2">Bzip2</link>扩展库</title>
+ <programlisting role="ini">
+ <![CDATA[
+// 将这一行
+;extension=php_bz2.dll
+
+// 改成这样
+extension=php_bz2.dll
+]]>
+</programlisting>
+ </example></para>
+ </listitem>
+ <listitem>
+ <para>有些扩展库需要额外的 DLL 才能工作。其中一部分包括在发行包
里,PHP 4 中在
+ <filename class="directory">C:\php\dlls\</filename>目录下,PHP 5 中在
主目录下,但还有一些,例如 Oracle(
+ <filename>php_oci8.dll</filename>)所需要的 DLL 没有绑定在发行包里。
如果安装 PHP 4,将绑定的 DLL 从
+ <filename class="directory">C:\php\dlls</filename>拷贝到主目录
+ <filename class="directory">C:\php</filename>中。别忘了将
+ <filename class="directory">C:\php</filename>放到系统路径
+ <varname>PATH</varname>中去(此过程在另外的
+ <link linkend="faq.installation.addtopath">FAQ 条目</link>中有说明
)。</para>
+ </listitem>
+ <listitem>
+ <para>某些 DLL 没有绑定在 PHP 发行包中,详情见每个扩展库的文档页。此
外有关
+ <acronym>PECL</acronym>的说明见手册页
+ <link linkend="install.pecl">PECL 扩展库安装</link>。在
+ <acronym>PECL</acronym>中有日益增加数目巨大的 PHP 扩展库,这些扩展库
需要
+ <link linkend="install.pecl.downloads">单独下载</link>。</para>
+ </listitem>
+ </itemizedlist>
+ <note>
+ <simpara>如果运行服务器模块版的 PHP,在修改了 &php.ini; 之后别忘了重新
启动 web 服务器以使其改动生效。</simpara>
+ </note></para>
+ <para>下表说明了哪些扩展库需要额外的 DLL。
+ <table xml:id="install.windows.extensions.overview">
+ <title>PHP 扩展库</title>
+ <tgroup cols="3">
+ <thead>
+ <row>
+ <entry>扩展库</entry>
+ <entry>说明</entry>
+ <entry>注解</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>php_bz2.dll</entry>
+ <entry>
+ <link linkend="ref.bzip2">bzip2</link>压缩函数库</entry>
+ <entry>无</entry>
+ </row>
+ <row>
+ <entry>php_calendar.dll</entry>
+ <entry>
+ <link linkend="ref.calendar">历法</link>转换函数库</entry>
+ <entry>自 PHP 4.0.3 起内置</entry>
+ </row>
+ <row>
+ <entry>php_crack.dll</entry>
+ <entry>
+ <link linkend="ref.crack">密码破解</link>函数库</entry>
+ <entry>无</entry>
+ </row>
+ <row>
+ <entry>php_ctype.dll</entry>
+ <entry>
+ <link linkend="ref.ctype">ctype</link>家族函数库</entry>
+ <entry>自 PHP 4.3.0 起内置</entry>
+ </row>
+ <row>
+ <entry>php_curl.dll</entry>
+ <entry>
+ <link linkend="ref.curl">CURL</link>,客户端 URL 库函数库</entry>
+ <entry>需要:
+ <filename>libeay32.dll</filename>,
+ <filename>ssleay32.dll</filename>(已附带)</entry>
+ </row>
+ <row>
+ <entry>php_dba.dll</entry>
+ <entry>
+ <link linkend="ref.dba">DBA</link>:数据库(dbm 风格)抽象层函数
库</entry>
+ <entry>无</entry>
+ </row>
+ <row>
+ <entry>php_dbase.dll</entry>
+ <entry>
+ <link linkend="ref.dbase">dBase</link>函数库</entry>
+ <entry>无</entry>
+ </row>
+ <row>
+ <entry>php_dbx.dll</entry>
+ <entry>
+ <link linkend="ref.dbx">dbx</link>函数库</entry>
+ <entry></entry>
+ </row>
+ <row>
+ <entry>php_domxml.dll</entry>
+ <entry>
+ <link linkend="ref.domxml">DOM XML</link>函数库</entry>
+ <entry>PHP &lt;= 4.2.0 需要:
+ <filename>libxml2.dll</filename>(已附带),PHP &gt;= 4.3.0 需
要:
+ <filename>iconv.dll</filename>(已附带)</entry>
+ </row>
+ <row>
+ <entry>php_dotnet.dll</entry>
+ <entry>
+ <link linkend="ref.dotnet">.NET</link>函数库</entry>
+ <entry>PHP &lt;= 4.1.1</entry>
+ </row>
+ <row>
+ <entry>php_exif.dll</entry>
+ <entry>
+ <link linkend="ref.exif">EXIF</link>函数库</entry>
+ <entry>需要
+ <link linkend="ref.mbstring">php_mbstring.dll</link>。并且在
&php.ini; 中,
+ <filename>php_exif.dll</filename>必须在
+ <filename>php_mbstring.dll</filename>
+ <literal>之后</literal>加载。</entry>
+ </row>
+ <row>
+ <entry>php_fbsql.dll</entry>
+ <entry>
+ <link linkend="ref.fbsql">FrontBase</link>函数库</entry>
+ <entry>PHP &lt;= 4.2.0</entry>
+ </row>
+ <row>
+ <entry>php_fdf.dll</entry>
+ <entry>
+ <link linkend="ref.fdf">FDF</link>:表单数据格式化函数库</entry>
+ <entry>需要:
+ <filename>fdftk.dll</filename>(已附带)</entry>
+ </row>
+ <row>
+ <entry>php_filepro.dll</entry>
+ <entry>
+ <link linkend="ref.filepro">filePro</link>函数库</entry>
+ <entry>只读访问</entry>
+ </row>
+ <row>
+ <entry>php_ftp.dll</entry>
+ <entry>
+ <link linkend="ref.ftp">FTP</link>函数库</entry>
+ <entry>自 PHP 4.0.3 起内置</entry>
+ </row>
+ <row>
+ <entry>php_gd.dll</entry>
+ <entry>
+ <link linkend="ref.image">GD</link>库图像函数库</entry>
+ <entry>在 PHP 4.3.2 中删除。此外注意在 GD1 中不能用真彩色函数,用
+ <filename>php_gd2.dll</filename>替代。</entry>
+ </row>
+ <row>
+ <entry>php_gd2.dll</entry>
+ <entry>
+ <link linkend="ref.image">GD</link>库图像函数库</entry>
+ <entry>GD2</entry>
+ </row>
+ <row>
+ <entry>php_gettext.dll</entry>
+ <entry>
+ <link linkend="ref.gettext">Gettext</link>函数库</entry>
+ <entry>PHP &lt;= 4.2.0 需要
+ <filename>gnu_gettext.dll</filename>(已附带),PHP &gt;= 4.2.3
需要
+ <filename>libintl-1.dll</filename>,
+ <filename>iconv.dll</filename>(已附带)。</entry>
+ </row>
+ <row>
+ <entry>php_hyperwave.dll</entry>
+ <entry>
+ <link linkend="ref.hw">HyperWave</link>函数库</entry>
+ <entry>无</entry>
+ </row>
+ <row>
+ <entry>php_iconv.dll</entry>
+ <entry>
+ <link linkend="ref.iconv">ICONV</link>字符集转换</entry>
+ <entry>需要:
+ <filename>iconv-1.3.dll</filename>(已附带),PHP &gt;=4.2.1 需要
+ <filename>iconv.dll</filename></entry>
+ </row>
+ <row>
+ <entry>php_ifx.dll</entry>
+ <entry>
+ <link linkend="ref.ifx">Informix</link>函数库</entry>
+ <entry>需要:Informix 库</entry>
+ </row>
+ <row>
+ <entry>php_iisfunc.dll</entry>
+ <entry>IIS 管理函数库</entry>
+ <entry>无</entry>
+ </row>
+ <row>
+ <entry>php_imap.dll</entry>
+ <entry>
+ <link linkend="ref.imap">IMAP</link>,POP3 和 NNTP 函数库</entry>
+ <entry>无</entry>
+ </row>
+ <row>
+ <entry>php_ingres.dll</entry>
+ <entry>
+ <link linkend="ref.ingres">Ingres II</link>函数库</entry>
+ <entry>需要:Ingres II 库</entry>
+ </row>
+ <row>
+ <entry>php_interbase.dll</entry>
+ <entry>
+ <link linkend="ref.ibase">InterBase</link>functions</entry>
+ <entry>需要:
+ <filename>gds32.dll</filename>(已附带)</entry>
+ </row>
+ <row>
+ <entry>php_java.dll</entry>
+ <entry>
+ <link linkend="ref.java">Java</link>函数库</entry>
+ <entry>PHP &lt;= 4.0.6 需要:
+ <filename>jvm.dll</filename>(已附带)</entry>
+ </row>
+ <row>
+ <entry>php_ldap.dll</entry>
+ <entry>
+ <link linkend="ref.ldap">LDAP</link>函数库</entry>
+ <entry>PHP &lt;= 4.2.0 需要
+ <filename>libsasl.dll</filename>(已附带),PHP &gt;= 4.3.0 需要
+ <filename>libeay32.dll</filename>,
+ <filename>ssleay32.dll</filename>(已附带)</entry>
+ </row>
+ <row>
+ <entry>php_mbstring.dll</entry>
+ <entry>
+ <link linkend="ref.mbstring">多字节字符串</link>函数库</entry>
+ <entry>无</entry>
+ </row>
+ <row>
+ <entry>php_mcrypt.dll</entry>
+ <entry>
+ <link linkend="ref.mcrypt">Mcrypt 加密</link>函数库</entry>
+ <entry>需要:
+ <filename>libmcrypt.dll</filename></entry>
+ </row>
+ <row>
+ <entry>php_mhash.dll</entry>
+ <entry>
+ <link linkend="ref.mhash">Mhash</link>函数库</entry>
+ <entry>PHP &gt;= 4.3.0 需要:
+ <filename>libmhash.dll</filename>(已附带)</entry>
+ </row>
+ <row>
+ <entry>php_mime_magic.dll</entry>
+ <entry>
+ <link linkend="book.mime-magic">Mimetype</link>函数库</entry>
+ <entry>需要:
+ <filename>magic.mime</filename>(已附带)</entry>
+ </row>
+ <row>
+ <entry>php_ming.dll</entry>
+ <entry>
+ <link linkend="ref.ming">Ming</link>函数库(Flash)</entry>
+ <entry>无</entry>
+ </row>
+ <row>
+ <entry>php_msql.dll</entry>
+ <entry>
+ <link linkend="ref.msql">mSQL</link>函数库</entry>
+ <entry>需要:
+ <filename>msql.dll</filename>(已附带)</entry>
+ </row>
+ <row>
+ <entry>php_mssql.dll</entry>
+ <entry>
+ <link linkend="ref.mssql">MSSQL</link>函数库</entry>
+ <entry>需要:
+ <filename>ntwdblib.dll</filename>(已附带)</entry>
+ </row>
+ <row>
+ <entry>php_mysql.dll</entry>
+ <entry>
+ <link linkend="ref.mysql">MySQL</link>函数库</entry>
+ <entry>PHP &gt;= 5.0.0 需要
+ <filename>libmysql.dll</filename>(已附带)</entry>
+ </row>
+ <row>
+ <entry>php_mysqli.dll</entry>
+ <entry>
+ <link linkend="ref.mysqli">MySQLi</link>函数库</entry>
+ <entry>PHP &gt;= 5.0.0 需要
+ <filename>libmysql.dll</filename>(PHP &lt;= 5.0.2 中是
+ <filename>libmysqli.dll</filename>)(已附带)</entry>
+ </row>
+ <row>
+ <entry>php_oci8.dll</entry>
+ <entry>
+ <link linkend="ref.oci8">Oracle 8</link>函数库</entry>
+ <entry>需要:Oracle 8.1+ 客户端库</entry>
+ </row>
+ <row>
+ <entry>php_openssl.dll</entry>
+ <entry>
+ <link linkend="ref.openssl">OpenSSL</link>函数库</entry>
+ <entry>需要:
+ <filename>libeay32.dll</filename>(已附带)</entry>
+ </row>
+ <row>
+ <entry>php_overload.dll</entry>
+ <entry>
+ <link linkend="ref.overload">对象重载</link>函数库</entry>
+ <entry>自 PHP 4.3.0 起内置</entry>
+ </row>
+ <row>
+ <entry>php_pdf.dll</entry>
+ <entry>
+ <link linkend="ref.pdf">PDF</link>函数库</entry>
+ <entry>无</entry>
+ </row>
+ <row>
+ <entry>php_pgsql.dll</entry>
+ <entry>
+ <link linkend="ref.pgsql">PostgreSQL</link>函数库</entry>
+ <entry>无</entry>
+ </row>
+ <row>
+ <entry>php_printer.dll</entry>
+ <entry>
+ <link linkend="ref.printer">打印机</link>函数库</entry>
+ <entry>无</entry>
+ </row>
+ <row>
+ <entry>php_shmop.dll</entry>
+ <entry>
+ <link linkend="ref.shmop">共享内存</link>函数库</entry>
+ <entry>无</entry>
+ </row>
+ <row>
+ <entry>php_snmp.dll</entry>
+ <entry>
+ <link linkend="ref.snmp">SNMP</link>函数库</entry>
+ <entry>仅用于 Windows NT!</entry>
+ </row>
+ <row>
+ <entry>php_soap.dll</entry>
+ <entry>
+ <link linkend="ref.soap">SOAP</link>函数库</entry>
+ <entry>PHP &gt;= 5.0.0</entry>
+ </row>
+ <row>
+ <entry>php_sockets.dll</entry>
+ <entry>
+ <link linkend="ref.sockets">Socket</link>函数库</entry>
+ <entry>无</entry>
+ </row>
+ <row>
+ <entry>php_sybase_ct.dll</entry>
+ <entry>
+ <link linkend="ref.sybase">Sybase</link>函数库</entry>
+ <entry>需要:Sybase 客户端库</entry>
+ </row>
+ <row>
+ <entry>php_tidy.dll</entry>
+ <entry>
+ <link linkend="ref.tidy">Tidy</link>函数库</entry>
+ <entry>PHP &gt;= 5.0.0</entry>
+ </row>
+ <row>
+ <entry>php_tokenizer.dll</entry>
+ <entry>
+ <link linkend="ref.tokenizer">Tokenizer</link>函数库</entry>
+ <entry>自 PHP 4.3.0 起内置</entry>
+ </row>
+ <row>
+ <entry>php_w32api.dll</entry>
+ <entry>
+ <link linkend="ref.w32api">W32api</link>函数库</entry>
+ <entry>无</entry>
+ </row>
+ <row>
+ <entry>php_xmlrpc.dll</entry>
+ <entry>
+ <link linkend="ref.xmlrpc">XML-RPC</link>函数库</entry>
+ <entry>PHP &gt;= 4.2.1 需要
+ <filename>iconv.dll</filename>(已附带)</entry>
+ </row>
+ <row>
+ <entry>php_xslt.dll</entry>
+ <entry>
+ <link linkend="ref.xslt">XSLT</link>函数库</entry>
+ <entry>PHP &lt;= 4.2.0 需要
+ <filename>sablot.dll</filename>,
+ <filename>expat.dll</filename>(已附带)。PHP &gt;= 4.2.1 需要
+ <filename>sablot.dll</filename>,
+ <filename>expat.dll</filename>,
+ <filename>iconv.dll</filename>(已附带)。</entry>
+ </row>
+ <row>
+ <entry>php_yaz.dll</entry>
+ <entry>
+ <link linkend="ref.yaz">YAZ</link>函数库</entry>
+ <entry>需要:
+ <filename>yaz.dll</filename>(已附带)</entry>
+ </row>
+ <row>
+ <entry>php_zip.dll</entry>
+ <entry>
+ <link linkend="ref.zip">Zip 文件</link>函数库</entry>
+ <entry>只读访问</entry>
+ </row>
+ <row>
+ <entry>php_zlib.dll</entry>
+ <entry>
+ <link linkend="ref.zlib">ZLib</link>压缩函数库</entry>
+ <entry>自 PHP 4.3.0 起内置</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table></para>
+</sect1>
+<!-- Keep this comment at the end of the file
+Local variables:
+mode: sgml
+sgml-omittag:t
+sgml-shorttag:t
+sgml-minimize-attributes:nil
+sgml-always-quote-attributes:t
+sgml-indent-step:1
+sgml-indent-data:t
+indent-tabs-mode:nil
+sgml-parent-document:nil
+sgml-default-dtd-file:"~/.phpdoc/manual.ced"
+sgml-exposed-tags:nil
+sgml-local-catalogs:nil
+sgml-local-ecat-files:nil
+End:
+vim600: syn=xml fen fdm=syntax fdl=2 si
+vim: et tw=78 syn=sgml
+vi: ts=1 sw=1
+-->
=======================================
--- /dev/null
+++ /trunk/xml/install/windows/index.xml Mon Apr 9 09:11:24 2012
@@ -0,0 +1,61 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- $Revision: 324974 $ -->
+<!-- EN-Revision: 321349 Maintainer: HonestQiao Status: ready -->
+<!-- Reviewed: no Maintainer: HonestQiao -->
+<!-- $EN-Revision: 297028 $ -->
+ <chapter xml:id="install.windows" xmlns="http://docbook.org/ns/docbook"
xmlns:xlink="http://www.w3.org/1999/xlink">
+<title>Windows 系统下的安装</title>
+<para>本节内容适用于 Windows 98/Me 以及 Windows NT/2000/XP/2003。PHP 不能
在 16 位平台例如 Windows 3.1 下运行。有时把支持 PHP 的 Windows 平台称为
Win32。自 PHP 4.3.0 开始不再支持 Windows 95。</para>
+<note>
+ <para>Windows 98/ME/NT4 is no longer supported as of PHP 5.3.0.</para>
+</note>
+<note>
+ <para>Windows 95 is no longer supported as of PHP 4.3.0.</para>
+</note>
+<para>有两种方法在 Windows 下安装 PHP:
+<link linkend="install.windows.manual">手工安装</link>或者使用
+<link linkend="install.windows.installer">安装程序</link>安装。</para>
+<para>如果有 Microsoft Visual Studio,也可以
+<link linkend="install.windows.building">编译</link>PHP 的源程序。</para>
+<para>一旦在 Windows 系统下安装好 PHP 之后,可能需要
+<link linkend="install.windows.extensions">加载各种扩展库</link>以实现更多
的功能。</para>
+<warning>
+ <para>互联网上还有一些多合一的安装程序,但是它们没有一个是被 PHP.net 认可
的,因为我们相信,从<link
xlink:href="&url.php.downloads;">&url.php.downloads;</link>下载官方Windows包
手动安装是系统安全和优化的最好选择。</para>
+</warning>
+
+ &install.windows.installer;
+ &install.windows.installermsi;
+ &install.windows.manual;
+ &install.windows.iis;
+ &install.windows.iis6;
+ &install.windows.iis7;
+ &install.windows.apache1;
+ &install.windows.apache2;
+ &install.windows.sun;
+ &install.windows.sambar;
+ &install.windows.xitami;
+ &install.windows.building;
+ &install.windows.extensions;
+ &install.windows.commandline;
+ </chapter>
+
+<!-- Keep this comment at the end of the file
+Local variables:
+mode: sgml
+sgml-omittag:t
+sgml-shorttag:t
+sgml-minimize-attributes:nil
+sgml-always-quote-attributes:t
+sgml-indent-step:1
+sgml-indent-data:t
+indent-tabs-mode:nil
+sgml-parent-document:nil
+sgml-default-dtd-file:"~/.phpdoc/manual.ced"
+sgml-exposed-tags:nil
+sgml-local-catalogs:nil
+sgml-local-ecat-files:nil
+End:
+vim600: syn=xml fen fdm=syntax fdl=2 si
+vim: et tw=78 syn=sgml
+vi: ts=1 sw=1
+-->
=======================================
--- /dev/null
+++ /trunk/xml/internals2/intro.xml Mon Apr 9 09:11:24 2012
@@ -0,0 +1,75 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- $Revision: 324974 $ -->
+<!-- EN-Revision: 301953 Maintainer: HonestQiao Status: ready -->
+<!-- Reviewed: no Maintainer: HonestQiao -->
+<!-- $EN-Revision: 297078 $ -->
+
+<!--
+ &internals2.intro;
+ &internals2.counter;
+ &internals2.buildsys.index; configure options, ext_skel, config.m4,
config.w32, static vs. dynamic builds
+ &internals2.structure.index; ext_skel, module structure, globals,
lifecycle, tests
+ &internals2.memory.index; management, persistence, TSRM
+ &internals2.variables.index; zval, hashtable, references, constants
+ &internals2.funcs.index; defining, arguments, return values,
passthru, aliasing, exceptions
+ &internals2.objects.index; classes, inheritance, properties, methods,
method-function mapping
+ &internals2.resources.index; defining, creating, retrieving, destroying
+ &internals2.ini.index; defining, retrieving, changing
+ &internals2.streams.index; using, wrappers, contexts, filters
+ &internals2.pdo.index; direct port of existing PDO docs
+ &internals2.faq.index; FAQ
+ &internals2.apiref.index; full index of all APIs, constants, macros,
etc.
+ &internals2.ze1.index; old docs, quick list of major differences,
short discussion re: OOP
+-->
+
+ <preface xml:id="internals2.preface"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns="http://docbook.org/ns/docbook">
+ <title>序言</title>
+
+ <simpara>
+ Zend API 随着时间不断向前进化,PHP 已变成为一种更健壮与普及的编程语言。
随着
+ PHP 5 的推出,Zend Engine 2 (ZE2)也到来了。ZE2
+ 带来了全新的面向对象编程(OOP)模型,以及大量 API 的改进。PHP 6
+ ,在此文档编写时还处于活跃的开发状态,引入了 Zend Engine 3
+ (ZE3),将在语言中带来完全的 Unicode 支持。
+ </simpara>
+
+ <warning>
+ <simpara>
+ 此文档还有大量的开发工作。原来的 Zend 文档被完整的保留在
+ <link linkend="internals2.ze1">Zend Engine 1</link>
+ 章节下,用于在此文档未完成前进行查看。
+ </simpara>
+ </warning>
+
+ <simpara>
+ 此手册章节针对于 ZE2。PHP 4.4 还在被广泛地使用着,与 ZE1
+ 扩展的工作方式的不同点比较少,因此在本章的附录中有对它的简单引用。在
+ PHP 6 进行 beta 测试阶段时,将会有更全面地进行文档工作。
+ </simpara>
+
+ <simpara>
+ 此章节的文档内容当前针对 PHP 5.2.11(本文编写时最新的 PHP 5.2 稳定发行版
本)。在
+ PHP 5 的小版本(5.0 - 5.3)上的差异会有相应的说明。
+ </simpara>
+ </preface>
+
+<!-- Keep this comment at the end of the file
+Local variables:
+mode: sgml
+sgml-omittag:t
+sgml-shorttag:t
+sgml-minimize-attributes:nil
+sgml-always-quote-attributes:t
+sgml-indent-step:1
+sgml-indent-data:t
+indent-tabs-mode:nil
+sgml-parent-document:nil
+sgml-default-dtd-file:"~/.phpdoc/manual.ced"
+sgml-exposed-tags:nil
+sgml-local-catalogs:nil
+sgml-local-ecat-files:nil
+End:
+vim600: syn=xml fen fdm=syntax fdl=2 si
+vim: et tw=78 syn=sgml
+vi: ts=1 sw=1
+-->
=======================================
--- /dev/null
+++ /trunk/xml/internals2/opcodes.xml Mon Apr 9 09:11:24 2012
@@ -0,0 +1,424 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- $Revision: 324974 $ -->
+<!-- EN-Revision: 323570 Maintainer: HonestQiao Status: ready -->
+<!-- Reviewed: no Maintainer: HonestQiao -->
+<!-- $EN-Revision: 297078 $ -->
+ <part xml:id="internals2.opcodes" xmlns="http://docbook.org/ns/docbook"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:xi="http://www.w3.org/2001/XInclude">
+ <title>Zend Engine 2 操作码列表</title>
+
+ <partintro xml:id="internals2.opcodes.preface">
+ <title>Opcode</title>
+ <para>
+ 此页列出并收录了由 Zend Engine 2 解析 PHP
+ 文件而生成的全部Opcode。使用 vld 扩展(参见
+ <link
xlink:href="&url.pecl.package;vld">&url.pecl.package;vld</link>)的
+ PHP 文件的Opcode可能会被丢弃。
+ </para>
+
+ <table>
+ <title>Opcode 列表</title>
+ <tgroup cols="3">
+ <thead>
+ <row>
+ <entry>编号</entry>
+ <entry>名称</entry>
+ <entry>是否有例子代码</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row><entry>0</entry><entry><xref
linkend="internals2.opcodes.nop"/></entry><entry>是</entry></row>
+ <row><entry>1</entry><entry><xref
linkend="internals2.opcodes.add"/></entry><entry>是</entry></row>
+ <row><entry>2</entry><entry><xref
linkend="internals2.opcodes.sub"/></entry><entry>是</entry></row>
+ <row><entry>3</entry><entry><xref
linkend="internals2.opcodes.mul"/></entry><entry>是</entry></row>
+ <row><entry>4</entry><entry><xref
linkend="internals2.opcodes.div"/></entry><entry>是</entry></row>
+ <row><entry>5</entry><entry><xref
linkend="internals2.opcodes.mod"/></entry><entry>是</entry></row>
+ <row><entry>6</entry><entry><xref
linkend="internals2.opcodes.sl"/></entry><entry>是</entry></row>
+ <row><entry>7</entry><entry><xref
linkend="internals2.opcodes.sr"/></entry><entry>是</entry></row>
+ <row><entry>8</entry><entry><xref
linkend="internals2.opcodes.concat"/></entry><entry>是</entry></row>
+ <row><entry>9</entry><entry><xref
linkend="internals2.opcodes.bw-or"/></entry><entry>是</entry></row>
+ <row><entry>10</entry><entry><xref
linkend="internals2.opcodes.bw-and"/></entry><entry>是</entry></row>
+ <row><entry>11</entry><entry><xref
linkend="internals2.opcodes.bw-xor"/></entry><entry>是</entry></row>
+ <row><entry>12</entry><entry><xref
linkend="internals2.opcodes.bw-not"/></entry><entry>是</entry></row>
+ <row><entry>13</entry><entry><xref
linkend="internals2.opcodes.bool-not"/></entry><entry>是</entry></row>
+ <row><entry>14</entry><entry><xref
linkend="internals2.opcodes.bool-xor"/></entry><entry>是</entry></row>
+ <row><entry>15</entry><entry><xref
linkend="internals2.opcodes.is-identical"/></entry><entry>是</entry></row>
+ <row>
+ <entry>16</entry><entry><xref
linkend="internals2.opcodes.is-not-identical"/></entry><entry>是</entry>
+ </row>
+ <row><entry>17</entry><entry><xref
linkend="internals2.opcodes.is-equal"/></entry><entry>是</entry></row>
+ <row><entry>18</entry><entry><xref
linkend="internals2.opcodes.is-not-equal"/></entry><entry>是</entry></row>
+ <row><entry>19</entry><entry><xref
linkend="internals2.opcodes.is-smaller"/></entry><entry>是</entry></row>
+ <row>
+ <entry>20</entry><entry><xref
linkend="internals2.opcodes.is-smaller-or-equal"/></entry><entry>是</entry>
+ </row>
+ <row><entry>21</entry><entry><xref
linkend="internals2.opcodes.cast"/></entry><entry>是</entry></row>
+ <row><entry>22</entry><entry><xref
linkend="internals2.opcodes.qm-assign"/></entry><entry>是</entry></row>
+ <row><entry>23</entry><entry><xref
linkend="internals2.opcodes.assign-add"/></entry><entry>是</entry></row>
+ <row><entry>24</entry><entry><xref
linkend="internals2.opcodes.assign-sub"/></entry><entry>是</entry></row>
+ <row><entry>25</entry><entry><xref
linkend="internals2.opcodes.assign-mul"/></entry><entry>是</entry></row>
+ <row><entry>26</entry><entry><xref
linkend="internals2.opcodes.assign-div"/></entry><entry>是</entry></row>
+ <row><entry>27</entry><entry><xref
linkend="internals2.opcodes.assign-mod"/></entry><entry>是</entry></row>
+ <row><entry>28</entry><entry><xref
linkend="internals2.opcodes.assign-sl"/></entry><entry>是</entry></row>
+ <row><entry>29</entry><entry><xref
linkend="internals2.opcodes.assign-sr"/></entry><entry>是</entry></row>
+ <row><entry>30</entry><entry><xref
linkend="internals2.opcodes.assign-concat"/></entry><entry>是</entry></row>
+ <row><entry>31</entry><entry><xref
linkend="internals2.opcodes.assign-bw-or"/></entry><entry>是</entry></row>
+ <row><entry>32</entry><entry><xref
linkend="internals2.opcodes.assign-bw-and"/></entry><entry>是</entry></row>
+ <row><entry>33</entry><entry><xref
linkend="internals2.opcodes.assign-bw-xor"/></entry><entry>是</entry></row>
+ <row><entry>34</entry><entry><xref
linkend="internals2.opcodes.pre-inc"/></entry><entry>是</entry></row>
+ <row><entry>35</entry><entry><xref
linkend="internals2.opcodes.pre-dec"/></entry><entry>是</entry></row>
+ <row><entry>36</entry><entry><xref
linkend="internals2.opcodes.post-inc"/></entry><entry>是</entry></row>
+ <row><entry>37</entry><entry><xref
linkend="internals2.opcodes.post-dec"/></entry><entry>是</entry></row>
+ <row><entry>38</entry><entry><xref
linkend="internals2.opcodes.assign"/></entry><entry>是</entry></row>
+ <row><entry>39</entry><entry><xref
linkend="internals2.opcodes.assign-ref"/></entry><entry>是</entry></row>
+ <row><entry>40</entry><entry><xref
linkend="internals2.opcodes.echo"/></entry><entry>是</entry></row>
+ <row><entry>41</entry><entry><xref
linkend="internals2.opcodes.print"/></entry><entry>是</entry></row>
+ <row><entry>42</entry><entry>未收录</entry><entry>否</entry></row>
+ <row><entry>43</entry><entry><xref
linkend="internals2.opcodes.jmpz"/></entry><entry>是</entry></row>
+ <row><entry>44</entry><entry><xref
linkend="internals2.opcodes.jmpnz"/></entry><entry>是</entry></row>
+ <row><entry>45</entry><entry><xref
linkend="internals2.opcodes.jmpznz"/></entry><entry>是</entry></row>
+ <row><entry>46</entry><entry><xref
linkend="internals2.opcodes.jmpz-ex"/></entry><entry>是</entry></row>
+ <row><entry>47</entry><entry><xref
linkend="internals2.opcodes.jmpnz-ex"/></entry><entry>是</entry></row>
+ <row><entry>48</entry><entry><xref
linkend="internals2.opcodes.case"/></entry><entry>是</entry></row>
+ <row><entry>49</entry><entry><xref
linkend="internals2.opcodes.switch-free"/></entry><entry>是</entry></row>
+ <row><entry>50</entry><entry><xref
linkend="internals2.opcodes.brk"/></entry><entry>是</entry></row>
+ <row><entry>51</entry><entry>未收录</entry><entry>否</entry></row>
+ <row><entry>52</entry><entry><xref
linkend="internals2.opcodes.bool"/></entry><entry>是</entry></row>
+ <row><entry>53</entry><entry><xref
linkend="internals2.opcodes.init-string"/></entry><entry>是</entry></row>
+ <row><entry>54</entry><entry><xref
linkend="internals2.opcodes.add-char"/></entry><entry>是</entry></row>
+ <row><entry>55</entry><entry><xref
linkend="internals2.opcodes.add-string"/></entry><entry>是</entry></row>
+ <row><entry>56</entry><entry><xref
linkend="internals2.opcodes.add-var"/></entry><entry>是</entry></row>
+ <row><entry>57</entry><entry><xref
linkend="internals2.opcodes.begin-silence"/></entry><entry>是</entry></row>
+ <row><entry>58</entry><entry><xref
linkend="internals2.opcodes.end-silence"/></entry><entry>是</entry></row>
+ <row>
+ <entry>59</entry><entry><xref
linkend="internals2.opcodes.init-fcall-by-name"/></entry><entry>是</entry>
+ </row>
+ <row><entry>60</entry><entry><xref
linkend="internals2.opcodes.do-fcall"/></entry><entry>是</entry></row>
+ <row>
+ <entry>61</entry><entry><xref
linkend="internals2.opcodes.do-fcall-by-name"/></entry><entry>是</entry>
+ </row>
+ <row><entry>62</entry><entry><xref
linkend="internals2.opcodes.return"/></entry><entry>是</entry></row>
+ <row><entry>63</entry><entry><xref
linkend="internals2.opcodes.recv"/></entry><entry>是</entry></row>
+ <row><entry>64</entry><entry><xref
linkend="internals2.opcodes.recv-init"/></entry><entry>是</entry></row>
+ <row><entry>65</entry><entry><xref
linkend="internals2.opcodes.send-val"/></entry><entry>是</entry></row>
+ <row><entry>66</entry><entry><xref
linkend="internals2.opcodes.send-var"/></entry><entry>是</entry></row>
+ <row><entry>67</entry><entry><xref
linkend="internals2.opcodes.send-ref"/></entry><entry>是</entry></row>
+ <row><entry>68</entry><entry><xref
linkend="internals2.opcodes.new"/></entry><entry>是</entry></row>
+ <row><entry>69</entry><entry>未收录</entry><entry>否</entry></row>
+ <row><entry>70</entry><entry><xref
linkend="internals2.opcodes.free"/></entry><entry>是</entry></row>
+ <row><entry>71</entry><entry><xref
linkend="internals2.opcodes.init-array"/></entry><entry>是</entry></row>
+ <row>
+ <entry>72</entry><entry><xref
linkend="internals2.opcodes.add-array-element"/></entry><entry>是</entry>
+ </row>
+ <row>
+ <entry>73</entry><entry><xref
linkend="internals2.opcodes.include-or-eval"/></entry><entry>是</entry>
+ </row>
+ <row><entry>74</entry><entry><xref
linkend="internals2.opcodes.unset-var"/></entry><entry>是</entry></row>
+ <row><entry>75</entry><entry><xref
linkend="internals2.opcodes.unset-dim"/></entry><entry>是</entry></row>
+ <row><entry>76</entry><entry><xref
linkend="internals2.opcodes.unset-obj"/></entry><entry>是</entry></row>
+ <row><entry>77</entry><entry><xref
linkend="internals2.opcodes.fe-reset"/></entry><entry>是</entry></row>
+ <row><entry>78</entry><entry><xref
linkend="internals2.opcodes.fe-fetch"/></entry><entry>是</entry></row>
+ <row><entry>79</entry><entry><xref
linkend="internals2.opcodes.exit"/></entry><entry>是</entry></row>
+ <row><entry>80</entry><entry><xref
linkend="internals2.opcodes.fetch-r"/></entry><entry>是</entry></row>
+ <row><entry>81</entry><entry><xref
linkend="internals2.opcodes.fetch-dim-r"/></entry><entry>是</entry></row>
+ <row><entry>82</entry><entry><xref
linkend="internals2.opcodes.fetch-obj-r"/></entry><entry>是</entry></row>
+ <row><entry>83</entry><entry><xref
linkend="internals2.opcodes.fetch-w"/></entry><entry>是</entry></row>
+ <row><entry>84</entry><entry><xref
linkend="internals2.opcodes.fetch-dim-w"/></entry><entry>是</entry></row>
+ <row><entry>85</entry><entry><xref
linkend="internals2.opcodes.fetch-obj-w"/></entry><entry>是</entry></row>
+ <row><entry>86</entry><entry><xref
linkend="internals2.opcodes.fetch-rw"/></entry><entry>是</entry></row>
+ <row><entry>87</entry><entry><xref
linkend="internals2.opcodes.fetch-dim-rw"/></entry><entry>是</entry></row>
+ <row><entry>88</entry><entry><xref
linkend="internals2.opcodes.fetch-obj-rw"/></entry><entry>是</entry></row>
+ <row><entry>89</entry><entry><xref
linkend="internals2.opcodes.fetch-is"/></entry><entry>是</entry></row>
+ <row><entry>90</entry><entry><xref
linkend="internals2.opcodes.fetch-dim-is"/></entry><entry>否</entry></row>
+ <row><entry>91</entry><entry><xref
linkend="internals2.opcodes.fetch-obj-is"/></entry><entry>否</entry></row>
+ <row>
+ <entry>92</entry><entry><xref
linkend="internals2.opcodes.fetch-func-arg"/></entry><entry>是</entry>
+ </row>
+ <row>
+ <entry>93</entry><entry><xref
linkend="internals2.opcodes.fetch-dim-func-arg"/></entry><entry>是</entry>
+ </row>
+ <row>
+ <entry>94</entry><entry><xref
linkend="internals2.opcodes.fetch-obj-func-arg"/></entry><entry>是</entry>
+ </row>
+ <row><entry>95</entry><entry><xref
linkend="internals2.opcodes.fetch-unset"/></entry><entry>否</entry></row>
+ <row>
+ <entry>96</entry><entry><xref
linkend="internals2.opcodes.fetch-dim-unset"/></entry><entry>否</entry>
+ </row>
+ <row>
+ <entry>97</entry><entry><xref
linkend="internals2.opcodes.fetch-obj-unset"/></entry><entry>否</entry>
+ </row>
+ <row>
+ <entry>98</entry><entry><xref
linkend="internals2.opcodes.fetch-dim-tmp-var"/></entry><entry>是</entry>
+ </row>
+ <row>
+ <entry>99</entry><entry><xref
linkend="internals2.opcodes.fetch-constant"/></entry><entry>是</entry>
+ </row>
+ <row>
+ <entry>100</entry><entry>未收录</entry><entry>否</entry>
+ </row>
+ <row><entry>101</entry><entry><xref
linkend="internals2.opcodes.ext-stmt"/></entry><entry>否</entry></row>
+ <row>
+ <entry>102</entry><entry><xref
linkend="internals2.opcodes.ext-fcall-begin"/></entry><entry>否</entry>
+ </row>
+ <row><entry>103</entry><entry><xref
linkend="internals2.opcodes.ext-fcall-end"/></entry><entry>否</entry></row>
+ <row><entry>104</entry><entry><xref
linkend="internals2.opcodes.ext-nop"/></entry><entry>否</entry></row>
+ <row><entry>105</entry><entry><xref
linkend="internals2.opcodes.ticks"/></entry><entry>是</entry></row>
+ <row>
+ <entry>106</entry><entry><xref
linkend="internals2.opcodes.send-var-no-ref"/></entry><entry>否</entry>
+ </row>
+ <row><entry>107</entry><entry><xref
linkend="internals2.opcodes.catch"/></entry><entry>是</entry></row>
+ <row><entry>108</entry><entry><xref
linkend="internals2.opcodes.throw"/></entry><entry>是</entry></row>
+ <row><entry>109</entry><entry><xref
linkend="internals2.opcodes.fetch-class"/></entry><entry>是</entry></row>
+ <row><entry>110</entry><entry><xref
linkend="internals2.opcodes.clone"/></entry><entry>是</entry></row>
+ <row>
+ <entry>111</entry><entry>未收录</entry><entry>否</entry>
+ </row>
+ <row>
+ <entry>112</entry><entry><xref
linkend="internals2.opcodes.init-method-call"/></entry><entry>是</entry>
+ </row>
+ <row>
+ <entry>113</entry>
+ <entry><xref
linkend="internals2.opcodes.init-static-method-call"/></entry>
+ <entry>是</entry>
+ </row>
+ <row>
+ <entry>114</entry><entry><xref
linkend="internals2.opcodes.isset-isempty-var"/></entry><entry>是</entry>
+ </row>
+ <row>
+ <entry>115</entry><entry><xref
linkend="internals2.opcodes.isset-isempty-dim-obj"/></entry><entry>是
</entry>
+ </row>
+ <row>
+ <entry>116</entry><entry>未收录</entry><entry>否</entry>
+ </row>
+ <row>
+ <entry>117</entry><entry>未收录</entry><entry>否</entry>
+ </row>
+ <row>
+ <entry>118</entry><entry>未收录</entry><entry>否</entry>
+ </row>
+ <row>
+ <entry>119</entry><entry>未收录</entry><entry>否</entry>
+ </row>
+ <row>
+ <entry>120</entry><entry>未收录</entry><entry>否</entry>
+ </row>
+ <row>
+ <entry>121</entry><entry>未收录</entry><entry>否</entry>
+ </row>
+ <row>
+ <entry>122</entry><entry>未收录</entry><entry>否</entry>
+ </row>
+ <row>
+ <entry>123</entry><entry>未收录</entry><entry>否</entry>
+ </row>
+ <row>
+ <entry>124</entry><entry>未收录</entry><entry>否</entry>
+ </row>
+ <row>
+ <entry>125</entry><entry>未收录</entry><entry>否</entry>
+ </row>
+ <row>
+ <entry>126</entry><entry>未收录</entry><entry>否</entry>
+ </row>
+ <row>
+ <entry>127</entry><entry>未收录</entry><entry>否</entry>
+ </row>
+ <row>
+ <entry>128</entry><entry>未收录</entry><entry>否</entry>
+ </row>
+ <row>
+ <entry>129</entry><entry>未收录</entry><entry>否</entry>
+ </row>
+ <row>
+ <entry>130</entry><entry>未收录</entry><entry>否</entry>
+ </row>
+ <row>
+ <entry>131</entry><entry>未收录</entry><entry>否</entry>
+ </row>
+ <row><entry>132</entry><entry><xref
linkend="internals2.opcodes.pre-inc-obj"/></entry><entry>是</entry></row>
+ <row><entry>133</entry><entry><xref
linkend="internals2.opcodes.pre-dec-obj"/></entry><entry>是</entry></row>
+ <row><entry>134</entry><entry><xref
linkend="internals2.opcodes.post-inc-obj"/></entry><entry>是</entry></row>
+ <row><entry>135</entry><entry><xref
linkend="internals2.opcodes.post-dec-obj"/></entry><entry>是</entry></row>
+ <row><entry>136</entry><entry><xref
linkend="internals2.opcodes.assign-obj"/></entry><entry>是</entry></row>
+ <row>
+ <entry>137</entry><entry>未收录</entry><entry>否</entry>
+ </row>
+ <row><entry>138</entry><entry><xref
linkend="internals2.opcodes.instanceof"/></entry><entry>是</entry></row>
+ <row>
+ <entry>139</entry><entry><xref
linkend="internals2.opcodes.declare-class"/></entry><entry>是</entry>
+ </row>
+ <row>
+ <entry>140</entry>
+ <entry><xref
linkend="internals2.opcodes.declare-inherited-class"/></entry>
+ <entry>是</entry>
+ </row>
+ <row>
+ <entry>141</entry><entry><xref
linkend="internals2.opcodes.declare-function"/></entry><entry>是</entry>
+ </row>
+ <row>
+ <entry>142</entry><entry><xref
linkend="internals2.opcodes.raise-abstract-error"/></entry><entry>是</entry>
+ </row>
+ <row>
+ <entry>143</entry><entry>未收录</entry><entry>否</entry>
+ </row>
+ <row><entry>144</entry><entry><xref
linkend="internals2.opcodes.add-interface"/></entry><entry>否</entry></row>
+ <row>
+ <entry>145</entry><entry>未收录</entry><entry>否</entry>
+ </row>
+ <row>
+ <entry>146</entry><entry><xref
linkend="internals2.opcodes.verify-abstract-class"/></entry><entry>否
</entry>
+ </row>
+ <row><entry>147</entry><entry><xref
linkend="internals2.opcodes.assign-dim"/></entry><entry>是</entry></row>
+ <row>
+ <entry>148</entry><entry><xref
linkend="internals2.opcodes.isset-isempty-prop-obj"/></entry><entry>是
</entry>
+ </row>
+ <row>
+ <entry>149</entry><entry><xref
linkend="internals2.opcodes.handle-exception"/></entry><entry>是</entry>
+ </row>
+ <row><entry>150</entry><entry><xref
linkend="internals2.opcodes.user-opcode"/></entry><entry>否</entry></row>
+ <row><entry>152</entry><entry>ZEND_JMP_SET</entry><entry>否
</entry></row>
+
<row><entry>153</entry><entry>ZEND_DECLARE_LAMBDA_FUNCTION</entry><entry>否
</entry></row>
+ </tbody>
+ </tgroup>
+ </table>
+ </partintro>
+
+ <chapter xml:id="internals2.opcodes.list">
+ <title>Opcode Descriptions and Examples</title>
+ &internals2.opcodes.add;
+ &internals2.opcodes.add-array-element;
+ &internals2.opcodes.add-char;
+ &internals2.opcodes.add-interface;
+ &internals2.opcodes.add-string;
+ &internals2.opcodes.add-var;
+ &internals2.opcodes.assign;
+ &internals2.opcodes.assign-add;
+ &internals2.opcodes.assign-bw-and;
+ &internals2.opcodes.assign-bw-or;
+ &internals2.opcodes.assign-bw-xor;
+ &internals2.opcodes.assign-concat;
+ &internals2.opcodes.assign-dim;
+ &internals2.opcodes.assign-div;
+ &internals2.opcodes.assign-mod;
+ &internals2.opcodes.assign-mul;
+ &internals2.opcodes.assign-obj;
+ &internals2.opcodes.assign-ref;
+ &internals2.opcodes.assign-sl;
+ &internals2.opcodes.assign-sr;
+ &internals2.opcodes.assign-sub;
+ &internals2.opcodes.begin-silence;
+ &internals2.opcodes.bool;
+ &internals2.opcodes.bool-not;
+ &internals2.opcodes.bool-xor;
+ &internals2.opcodes.brk;
+ &internals2.opcodes.bw-and;
+ &internals2.opcodes.bw-not;
+ &internals2.opcodes.bw-or;
+ &internals2.opcodes.bw-xor;
+ &internals2.opcodes.case;
+ &internals2.opcodes.cast;
+ &internals2.opcodes.catch;
+ &internals2.opcodes.clone;
+ &internals2.opcodes.concat;
+ &internals2.opcodes.cont;
+ &internals2.opcodes.declare-class;
+ &internals2.opcodes.declare-const;
+ &internals2.opcodes.declare-function;
+ &internals2.opcodes.declare-inherited-class;
+ &internals2.opcodes.declare-inherited-class-delayed;
+ &internals2.opcodes.div;
+ &internals2.opcodes.do-fcall;
+ &internals2.opcodes.do-fcall-by-name;
+ &internals2.opcodes.echo;
+ &internals2.opcodes.end-silence;
+ &internals2.opcodes.exit;
+ &internals2.opcodes.ext-fcall-begin;
+ &internals2.opcodes.ext-fcall-end;
+ &internals2.opcodes.ext-nop;
+ &internals2.opcodes.ext-stmt;
+ &internals2.opcodes.fe-fetch;
+ &internals2.opcodes.fe-reset;
+ &internals2.opcodes.fetch-class;
+ &internals2.opcodes.fetch-constant;
+ &internals2.opcodes.fetch-dim-func-arg;
+ &internals2.opcodes.fetch-dim-is;
+ &internals2.opcodes.fetch-dim-r;
+ &internals2.opcodes.fetch-dim-rw;
+ &internals2.opcodes.fetch-dim-tmp-var;
+ &internals2.opcodes.fetch-dim-unset;
+ &internals2.opcodes.fetch-dim-w;
+ &internals2.opcodes.fetch-func-arg;
+ &internals2.opcodes.fetch-is;
+ &internals2.opcodes.fetch-obj-func-arg;
+ &internals2.opcodes.fetch-obj-is;
+ &internals2.opcodes.fetch-obj-r;
+ &internals2.opcodes.fetch-obj-rw;
+ &internals2.opcodes.fetch-obj-unset;
+ &internals2.opcodes.fetch-obj-w;
+ &internals2.opcodes.fetch-r;
+ &internals2.opcodes.fetch-rw;
+ &internals2.opcodes.fetch-unset;
+ &internals2.opcodes.fetch-w;
+ &internals2.opcodes.free;
+ &internals2.opcodes.goto;
+ &internals2.opcodes.handle-exception;
+ &internals2.opcodes.include-or-eval;
+ &internals2.opcodes.init-array;
+ &internals2.opcodes.init-fcall-by-name;
+ &internals2.opcodes.init-method-call;
+ &internals2.opcodes.init-ns-fcall-by-name;
+ &internals2.opcodes.init-static-method-call;
+ &internals2.opcodes.init-string;
+ &internals2.opcodes.instanceof;
+ &internals2.opcodes.is-equal;
+ &internals2.opcodes.is-identical;
+ &internals2.opcodes.is-not-equal;
+ &internals2.opcodes.is-not-identical;
+ &internals2.opcodes.is-smaller;
+ &internals2.opcodes.is-smaller-or-equal;
+ &internals2.opcodes.isset-isempty-dim-obj;
+ &internals2.opcodes.isset-isempty-prop-obj;
+ &internals2.opcodes.isset-isempty-var;
+ &internals2.opcodes.jmp;
+ &internals2.opcodes.jmpnz;
+ &internals2.opcodes.jmpnz-ex;
+ &internals2.opcodes.jmpz;
+ &internals2.opcodes.jmpz-ex;
+ &internals2.opcodes.jmpznz;
+ &internals2.opcodes.mod;
+ &internals2.opcodes.mul;
+ &internals2.opcodes.new;
+ &internals2.opcodes.nop;
+ &internals2.opcodes.post-dec;
+ &internals2.opcodes.post-dec-obj;
+ &internals2.opcodes.post-inc;
+ &internals2.opcodes.post-inc-obj;
+ &internals2.opcodes.pre-dec;
+ &internals2.opcodes.pre-dec-obj;
+ &internals2.opcodes.pre-inc;
+ &internals2.opcodes.pre-inc-obj;
+ &internals2.opcodes.print;
+ &internals2.opcodes.qm-assign;
+ &internals2.opcodes.raise-abstract-error;
+ &internals2.opcodes.recv;
+ &internals2.opcodes.recv-init;
+ &internals2.opcodes.return;
+ &internals2.opcodes.return-by-ref;
+ &internals2.opcodes.send-ref;
+ &internals2.opcodes.send-val;
+ &internals2.opcodes.send-var;
+ &internals2.opcodes.send-var-no-ref;
+ &internals2.opcodes.sl;
+ &internals2.opcodes.sr;
+ &internals2.opcodes.sub;
+ &internals2.opcodes.switch-free;
+ &internals2.opcodes.throw;
+ &internals2.opcodes.ticks;
+ &internals2.opcodes.unset-dim;
+ &internals2.opcodes.unset-obj;
+ &internals2.opcodes.unset-var;
+ &internals2.opcodes.user-opcode;
+ &internals2.opcodes.verify-abstract-class;
+ &internals2.opcodes.zend-declare-lambda-function;
+ &internals2.opcodes.zend-jmp-set;
+ </chapter>
+ </part>
=======================================
--- /dev/null
+++ /trunk/xml/language/control-structures/require.xml Mon Apr 9 09:11:24
2012
@@ -0,0 +1,77 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- $Revision: 324974 $ -->
+<!-- EN-Revision: 324522 Maintainer: HonestQiao Status: ready -->
+<!-- Reviewed: no Maintainer: HonestQiao -->
+<sect1 xml:id="function.require" xmlns="http://docbook.org/ns/docbook"
xmlns:xlink="http://www.w3.org/1999/xlink">
+ <title>require</title>
+ <?phpdoc print-version-for="require"?>
+
+ <para>
+ <function>require</function> 语句包含并运行指定文件。有关包括如何工作的
详细信息见
+ <function>include</function> 的文档。
+ </para>
+ <para>
+ <function>require</function> 和 <function>include</function>
+ 几乎完全一样,除了处理失败的方式不同之外。<function>include</function>
产生一个<link
linkend="errorfunc.constants.errorlevels.e-warning">Warning</link>而
<function>require</function>
+ 则导致一个<link linkend="errorfunc.constants.errorlevels.e-error">
+ Fatal Error</link>。换句话说,如果想在丢失文件时停止处理页面,那就别犹
豫了,用
+ <function>require</function> 吧。<function>include</function>
+ 就不是这样,脚本会继续运行。同时也要确认设置了合适的<link
+ linkend="ini.include-path">include_path</link>。
+ </para>
+ <para>
+ <example>
+ <title>基本的 <function>require</function> 例子</title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+
+require 'prepend.php';
+
+require $somefile;
+
+require ('somefile.txt');
+
+?>
+]]>
+ </programlisting>
+ </example>
+ </para>
+ <para>
+ 更多例子参见 <function>include</function> 文档。
+ </para>
+ <note>
+ <para>
+ 在 PHP 4.0.2 之前适用以下规则:<function>require</function>
+ 总是会尝试读取目标文件,即使它所在的行根本就不会执行。条件语句不会影响
+ <function>require</function>。不过如果 <function>require</function>
+ 所在的行没有执行,则目标文件中的代码也不会执行。同样,循环结构也不影响
+ <function>require</function> 的行为。尽管目标文件中包含的代码仍然是循环
的主体,但
+ <function>require</function> 本身只会运行一次。
+ </para>
+ </note>
+ <para>
+ 查看 <link linkend="function.include"><literal>include</literal></link>
文档了解如何工作的。
+ </para>
+ </sect1>
+
+<!-- Keep this comment at the end of the file
+Local variables:
+mode: sgml
+sgml-omittag:t
+sgml-shorttag:t
+sgml-minimize-attributes:nil
+sgml-always-quote-attributes:t
+sgml-indent-step:1
+sgml-indent-data:t
+indent-tabs-mode:nil
+sgml-parent-document:nil
+sgml-default-dtd-file:"~/.phpdoc/manual.ced"
+sgml-exposed-tags:nil
+sgml-local-catalogs:nil
+sgml-local-ecat-files:nil
+End:
+vim600: syn=xml fen fdm=syntax fdl=2 si
+vim: et tw=78 syn=sgml
+vi: ts=1 sw=1
+-->
=======================================
--- /dev/null
+++ /trunk/xml/language/functions.xml Mon Apr 9 09:11:24 2012
@@ -0,0 +1,741 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- $Revision: 324974 $ -->
+<!-- EN-Revision: 324522 Maintainer: HonestQiao Status: ready -->
+<!-- Reviewed: no Maintainer: HonestQiao -->
+<!-- CREDITS: Gregory, dallas -->
+ <chapter xml:id="language.functions"
xmlns="http://docbook.org/ns/docbook">
+ <title>函数</title>
+
+ <sect1 xml:id="functions.user-defined">
+ <title>用户自定义函数</title>
+
+ <para>
+ 一个函数可由以下的语法来定义:
+ </para>
+ <para>
+ <example>
+ <title>展示函数用途的伪代码</title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+function foo($arg_1, $arg_2, ..., $arg_n)
+{
+ echo "Example function.\n";
+ return $retval;
+}
+?>
+]]>
+ </programlisting>
+ </example>
+ </para>
+
+ <simpara>
+ 任何有效的 PHP 代码都有可能出现在函数内部,甚至包括其它函数和<link
+ linkend="keyword.class">类</link>定义。
+ </simpara>
+ <para>
+ 函数名和 PHP 中的其它标识符命名规则相同。有效的函数名以字母或下划线打
头,后面跟字母,数字或下划线。可以用正则表达式表示
为:<literal>[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*</literal>。
+ </para>
+ &tip.userlandnaming;
+ <para>
+ <emphasis>除非</emphasis>是下面两个例子中的情况,函数必须在其调用之前定
义。
+ </para>
+ <para>
+ <example>
+ <title>条件函数(Conditional functions)</title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+
+$makefoo = true;
+
+/* 我们不能在处调用foo()函数,
+ 因为它还不存在,但可以调用bar()函数。*/
+
+bar();
+
+if ($makefoo) {
+ function foo()
+ {
+ echo "I don't exist until program execution reaches me.\n";
+ }
+}
+
+/* 现在我们可以安全调用函数 foo()了,
+ 因为 $makefoo 值为真 */
+
+if ($makefoo) foo();
+
+function bar()
+{
+ echo "I exist immediately upon program start.\n";
+}
+
+?>
+]]>
+ </programlisting>
+ </example>
+ </para>
+ <para>
+ <example>
+ <title>函数中的函数</title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+function foo()
+{
+ function bar()
+ {
+ echo "I don't exist until foo() is called.\n";
+ }
+}
+
+/* 现在还不能调用bar()函数,因为它还不存在 */
+
+foo();
+
+/* 现在可以调用bar()函数了,因为foo()函数
+ 的执行使得bar()函数变为已定义的函数 */
+
+bar();
+
+?>
+]]>
+ </programlisting>
+ </example>
+ </para>
+ <para>
+ PHP 中的所有函数和类都具有全局作用域,可以在内部定义外部调用,反之亦
然。
+ </para>
+ <simpara>
+ PHP 不支持函数重载,也不可能取消定义或者重定义已声明的函数。
+ </simpara>
+ <note>
+ <simpara>
+ 函数名是大小写无关的,不过在调用函数的时候,通常使用其在定义时相同的形
式。
+ </simpara>
+ </note>
+ <simpara>
+ PHP 支持<link linkend="functions.variable-arg-list">可变数量的参数
</link>和<link
+ linkend="functions.arguments.default">默认参数</link>。具体请参考:
+
<function>func_num_args</function>,<function>func_get_arg</function>,以及
<function>func_get_args</function>。
+ </simpara>
+
+ <para>
+ 在 PHP 中可以调用递归函数。但是要避免递归函数/方法调用超过
+ 100-200 层,因为可能会破坏堆栈从而使当前脚本终止。
+ <example>
+ <title>递归函数</title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+function recursion($a)
+{
+ if ($a < 20) {
+ echo "$a\n";
+ recursion($a + 1);
+ }
+}
+?>
+]]>
+ </programlisting>
+ </example>
+ </para>
+ </sect1>
+
+ <sect1 xml:id="functions.arguments">
+ <title>函数的参数</title>
+
+ <simpara>
+ 通过参数列表可以传递信息到函数,即以逗号作为分隔符的表达式列表。
+ </simpara>
+ <para>
+ PHP 支持按值传递参数(默认),<link
+ linkend="functions.arguments.by-reference">通过引用传递参数</link>以及
<link
+ linkend="functions.arguments.default">默认参数</link>。也支持可变数量的
参数;更多信息请参照<link
+ linkend="functions.variable-arg-list">可变长度参数列表</link>和涉及到的
相关函数
+ <function>func_num_args</function>,<function>func_get_arg</function>
以及
+ <function>func_get_args</function>。
+ </para>
+ <para>
+ <example>
+ <title>向函数传递数组</title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+function takes_array($input)
+{
+ echo "$input[0] + $input[1] = ", $input[0]+$input[1];
+}
+?>
+]]>
+ </programlisting>
+ </example>
+ </para>
+
+ <sect2 xml:id="functions.arguments.by-reference">
+ <title>通过引用传递参数</title>
+
+ <simpara>
+ 缺省情况下,函数参数通过值传递(因而即使在函数内部改变参数的值,它并不
会改变函数外部的值)。如果希望允许函数修改它的参数值,必须通过引用传递参数。
+ </simpara>
+ <para>
+ 如果想要函数的一个参数总是通过引用传递,可以在函数定义中该参数的前面预
先加上符号 &amp;:
+ </para>
+ <para>
+ <example>
+ <title>用引用传递函数参数</title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+function add_some_extra(&$string)
+{
+ $string .= 'and something extra.';
+}
+$str = 'This is a string, ';
+add_some_extra($str);
+echo $str; // outputs 'This is a string, and something extra.'
+?>
+]]>
+ </programlisting>
+ </example>
+ </para>
+
+ </sect2>
+
+ <sect2 xml:id="functions.arguments.default">
+ <title>默认参数的值</title>
+
+ <para>
+ 函数可以定义 C++ 风格的标量参数默认值,如下:
+ </para>
+ <para>
+ <example>
+ <title>在函数中使用默认参数</title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+function makecoffee($type = "cappuccino")
+{
+ return "Making a cup of $type.\n";
+}
+echo makecoffee();
+echo makecoffee(null);
+echo makecoffee("espresso");
+?>
+]]>
+ </programlisting>
+ &example.outputs;
+ <screen>
+<![CDATA[
+Making a cup of cappuccino.
+Making a cup of .
+Making a cup of espresso.
+]]>
+ </screen>
+ </example>
+ </para>
+
+ <para>
+ 上面代码段的输出是:
+ </para>
+ <para>
+ <screen>
+Making a cup of cappuccino.
+Making a cup of .
+Making a cup of espresso.
+ </screen>
+ </para>
+
+ <para>
+ PHP 还允许使用数组和特殊类型 NULL 作为默认参数,例如:
+ </para>
+ <para>
+ <example>
+ <title>使用非标量类型作为默认参数</title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+function makecoffee($types = array("cappuccino"), $coffeeMaker = NULL)
+{
+ $device = is_null($coffeeMaker) ? "hands" : $coffeeMaker;
+ return "Making a cup of ".join(", ", $types)." with $device.\n";
+}
+echo makecoffee();
+echo makecoffee(array("cappuccino", "lavazza"), "teapot");
+?>
+]]>
+ </programlisting>
+ </example>
+ </para>
+
+ <simpara>
+ 默认值必须是常量表达式,不能是诸如变量,类成员,或者函数调用等表达式。
+ </simpara>
+ <para>
+ 请注意当使用默认参数时,任何默认参数必须放在任何非默认参数的右侧;否
则,函数将不会按照预期的情况工作。考虑下面的代码片断:
+ </para>
+ <para>
+ <example>
+ <title>函数默认参数不正确的用法</title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+function makeyogurt($type = "acidophilus", $flavour)
+{
+ return "Making a bowl of $type $flavour.\n";
+}
+
+echo makeyogurt("raspberry"); // won't work as expected
+?>
+]]>
+ </programlisting>
+ </example>
+ </para>
+ <para>
+ 上述例子的输出是:
+ </para>
+ <para>
+ <screen>
+Warning: Missing argument 2 in call to makeyogurt() in
+/usr/local/etc/httpd/htdocs/php3test/functest.html on line 41
+Making a bowl of raspberry .
+ </screen>
+ </para>
+ <para>
+ 现在,比较上面的例子和这个例子:
+ </para>
+ <para>
+ <example>
+ <title>函数默认参数正确的用法</title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+function makeyogurt($flavour, $type = "acidophilus")
+{
+ return "Making a bowl of $type $flavour.\n";
+}
+
+echo makeyogurt("raspberry"); // works as expected
+?>
+]]>
+ </programlisting>
+ </example>
+ </para>
+ <para>
+ 这个例子的输出是:
+ </para>
+ <para>
+ <screen>
+Making a bowl of acidophilus raspberry.
+ </screen>
+ </para>
+
+ <note>
+ <simpara>
+ 自 PHP 5 起,默认值可以通过引用传递。
+ </simpara>
+ </note>
+
+ </sect2>
+
+ <sect2 xml:id="functions.variable-arg-list">
+ <title>可变数量的参数列表</title>
+
+ <simpara>
+ PHP 4 及更高版本已经在用户自定义函数中支持可变数量的参数列表。其实很简
单,只需使用
+
<function>func_num_args</function>,<function>func_get_arg</function>,和
+ <function>func_get_args</function> 函数即可。
+ </simpara>
+
+ <simpara>
+ 可变参数并不需要特别的语法,参数列表仍按函数定义的方式传递给函数,并按
通常的方式使用这些参数。
+ </simpara>
+
+ </sect2>
+
+ </sect1>
+
+ <sect1 xml:id="functions.returning-values">
+ <title>返回值</title>
+
+ <para>
+ 值通过使用可选的返回语句返回。可以返回包括数组和对象的任意类型。返回语
句会立即中止函数的运行,并且将控制权交回调用该函数的代码行。更多信息见
+ <function>return</function>。
+ </para>
+ <para>
+ <example>
+ <title><function>return</function> 的使用</title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+function square($num)
+{
+ return $num * $num;
+}
+echo square(4); // outputs '16'.
+?>
+]]>
+ </programlisting>
+ </example>
+ </para>
+
+ <para>
+ 函数不能返回多个值,但可以通过返回一个数组来得到类似的效果。
+ </para>
+ <para>
+ <example>
+ <title>返回一个数组以得到多个返回值</title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+function small_numbers()
+{
+ return array (0, 1, 2);
+}
+list ($zero, $one, $two) = small_numbers();
+?>
+]]>
+ </programlisting>
+ </example>
+ </para>
+ <para>
+ 从函数返回一个引用,必须在函数声明和指派返回值给一个变量时都使用引用操
作符 &amp; :
+ </para>
+ <para>
+ <example>
+ <title>从函数返回一个引用</title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+function &returns_reference()
+{
+ return $someref;
+}
+
+$newref =& returns_reference();
+?>
+]]>
+ </programlisting>
+ </example>
+ </para>
+ <simpara>
+ 有关引用的更多信息, 请查看<link
+ linkend="language.references">引用的解释</link>。
+ </simpara>
+ </sect1>
+
+ <sect1 xml:id="functions.variable-functions">
+ <title>可变函数</title>
+
+ <para>
+ PHP 支持可变函数的概念。这意味着如果一个变量名后有圆括号,PHP
+ 将寻找与变量的值同名的函数,并且尝试执行它。可变函数可以用来实现包括回
调函数,函数表在内的一些用途。
+ </para>
+ <para>
+ 变量函数不能用于语言结构,例如
+
<function>echo</function>,<function>print</function>,<function>unset</function>,<function>isset</function>,<function>empty</function>,<function>include</function>,<function>require</function>
+ 以及类似的语句。需要使用自己的包装函数来将这些结构用作变量函数。
+ </para>
+ <para>
+ <example>
+ <title>可变函数示例</title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+function foo() {
+ echo "In foo()<br />\n";
+}
+
+function bar($arg = '') {
+ echo "In bar(); argument was '$arg'.<br />\n";
+}
+
+// 使用 echo 的包装函数
+function echoit($string)
+{
+ echo $string;
+}
+
+$func = 'foo';
+$func(); // This calls foo()
+
+$func = 'bar';
+$func('test'); // This calls bar()
+
+$func = 'echoit';
+$func('test'); // This calls echoit()
+?>
+]]>
+ </programlisting>
+ </example>
+ </para>
+ <para>
+ 还可以利用可变函数的特性来调用一个对象的方法。
+ <example>
+ <title>可变方法范例</title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+class Foo
+{
+ function Variable()
+ {
+ $name = 'Bar';
+ $this->$name(); // This calls the Bar() method
+ }
+
+ function Bar()
+ {
+ echo "This is Bar";
+ }
+}
+
+$foo = new Foo();
+$funcname = "Variable";
+$foo->$funcname(); // This calls $foo->Variable()
+
+?>
+]]>
+ </programlisting>
+ </example>
+ </para>
+ <para>
+ 请参阅 <function>call_user_func</function>,<link
+ linkend="language.variables.variable">可变变量</link>和
+ <function>function_exists</function>。
+ </para>
+
+ </sect1>
+
+<sect1 xml:id="functions.internal">
+ <title>内部(内置)函数</title>
+
+ <para>
+ PHP 有很多标准的函数和结构。还有一些函数需要和特定地 PHP
+ 扩展模块一起编译,否则在使用它们的时候就会得到一个致命的"未定义函数
"错误。例如,要使用<link
+ linkend="ref.image">image</link>函数比如
+ <function>imagecreatetruecolor</function>,需要在编译 PHP 的时候加上
+ <productname>GD</productname> 的支持。或者,要使用
+ <function>mysql_connect</function> 函数,就需要在编译 PHP 的时候加上
+ <link linkend="ref.mysql">MySQL</link> 支持。有很多核心函数已包含在每
个版本的
+ PHP 中如<link linkend="ref.strings">字符串</link>和<link
+ linkend="ref.var">变量</link>函数。调用
+ <function>phpinfo</function> 或者
<function>get_loaded_extensions</function>
+ 可以得知 PHP 加载了那些扩展库。同时还应该注意,很多扩展库默认就是有效
的。PHP
+ 手册按照不同的扩展库组织了它们的文档。请参阅<link
+ linkend="configuration">配置</link>,<link
+ linkend="install">安装</link>以及各自的扩展库章节以获取有关如何设置
PHP 的信息。
+ </para>
+ <para>
+ 手册中<link
+ linkend="about.prototypes">如何阅读函数原型</link>讲解了如何阅读和理
解一个函数的原型。确认一个函数将返回什么,或者函数是否直接作用于传递的参数是
很重要的。例如,<function>str_replace</function>
+ 函数将返回修改过的字符串,而 <function>usort</function>
+ 却直接作用于传递的参数变量本身。手册中,每一个函数的页面中都有关于函
数参数、行为改变、成功与否的返回值以及使用条件等信息。了解这些重要的(常常是
细微的)差别是编写正确的
+ PHP 代码的关键。
+ </para>
+ <note>
+ <simpara>
+ 如果传递给函数的参数类型与实际的类型不一致,例如将一个
<type>array</type>传递给一个<type>string</type>类型的变量,那么函数的返回值
是不确定的。在这种情况下,通常函数会返回&null;。但这仅仅是一个约定,并不一定
如此。
+ </simpara>
+ </note>
+ <para>
+ 参见 <function>function_exists</function>,<link
+ linkend="funcref">函数参考
</link>,<function>get_extension_funcs</function>
+ 和 <function>dl</function>。
+ </para>
+ </sect1>
+
+ <sect1 xml:id="functions.anonymous">
+ <title>匿名函数</title>
+
+ <simpara>
+ 匿名函数(Anonymous functions),也叫闭包函数
(<literal>closures</literal>),允许
+ 临时创建一个没有指定名称的函数。最经常用作回调函数(<link
linkend="language.types.callback">callback</link>)的参数。
+ 当然,也有其他应用的情况。
+ </simpara>
+
+ <example>
+ <title>Anonymous function 示例</title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+echo preg_replace_callback('~-([a-z])~', function ($match) {
+ return strtoupper($match[1]);
+}, 'hello-world');
+// 输出 helloWorld
+?>
+]]>
+ </programlisting>
+ </example>
+
+ <simpara>
+ 闭包函数也可以作为变量的值来使用。PHP会自动把表达式转换成内置类
<classname>Closure</classname>的
+ 对象实例。把一个closure对象赋值给一个变量的方式与普通变量赋值的语法是一样
的,最后也要加上分号。
+ </simpara>
+
+ <example>
+ <title>匿名函数变量赋值示例</title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+$greet = function($name)
+{
+ printf("Hello %s\r\n", $name);
+};
+
+$greet('World');
+$greet('PHP');
+?>
+]]>
+ </programlisting>
+ </example>
+
+ <simpara>
+ Closure对象也会从父作用域中继承类属性。这些变量都必须在函数或类的头部声
明。从父作用域中继承
+ 变量与使用全局变量是*不同*的。全局变量存在于一个全局的范围,无论当前在执行
的是哪个函数。而closure
+ 的父类作用域则是声明该closure的函数(不一定要是它被调用的函数)。示例如
下:
+ </simpara>
+
+ <example>
+ <title>Closures和作用域</title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+// 一个基本的购物车,包括一些已经添加的商品和每种商品的数量。
+// 其中有一个方法用来计算购物车中所有商品的总价格。该方法使用了一个
closure作为回调函数。
+class Cart
+{
+ const PRICE_BUTTER = 1.00;
+ const PRICE_MILK = 3.00;
+ const PRICE_EGGS = 6.95;
+
+ protected $products = array();
+
+ public function add($product, $quantity)
+ {
+ $this->products[$product] = $quantity;
+ }
+
+ public function getQuantity($product)
+ {
+ return isset($this->products[$product]) ?
$this->products[$product] :
+ FALSE;
+ }
+
+ public function getTotal($tax)
+ {
+ $total = 0.00;
+
+ $callback =
+ function ($quantity, $product) use ($tax, &$total)
+ {
+ $pricePerItem = constant(__CLASS__ . "::PRICE_" .
+ strtoupper($product));
+ $total += ($pricePerItem * $quantity) * ($tax + 1.0);
+ };
+
+ array_walk($this->products, $callback);
+ return round($total, 2);;
+ }
+}
+
+$my_cart = new Cart;
+
+// 往购物车里添加条目
+$my_cart->add('butter', 1);
+$my_cart->add('milk', 3);
+$my_cart->add('eggs', 6);
+
+// 打出出总价格,其中有 5% 的销售税.
+print $my_cart->getTotal(0.05) . "\n";
+// The result is 54.29
+?>
+]]>
+ </programlisting>
+ </example>
+
+ <simpara>
+ 匿名函数目前是通过<link linkend="reserved.classes.closure">
+ <classname>Closure</classname></link>类来实现的。目前还不稳定,不适用于
正式开发。
+ </simpara>
+
+ <note>
+ <simpara>
+ 匿名函数只在PHP 5.3.0 及以上版本有效。
+ </simpara>
+ </note>
+
+ <note>
+ <simpara>
+ 在closure内部可以调用 <function>func_num_args</function>,
+ <function>func_get_arg</function>, 和
<function>func_get_args</function>
+ 等函数来获取参数信息。
+ </simpara>
+ </note>
+
+ <sect2 role="changelog">
+ &reftitle.changelog;
+ <para>
+ <informaltable>
+ <tgroup cols="2">
+ <thead>
+ <row>
+ <entry>&Version;</entry>
+ <entry>&Description;</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>5.4.0</entry>
+ <entry>
+ <varname>$this</varname> can be used in anonymous functions.
+ </entry>
+ </row>
+ <row>
+ <entry>5.3.0</entry>
+ <entry>
+ Anonymous functions become available.
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </informaltable>
+ </para>
+ </sect2>
+
+ <sect2 role="notes">
+ &reftitle.notes;
+ <note>
+ <simpara>
+ It is possible to use <function>func_num_args</function>,
+ <function>func_get_arg</function>, and
<function>func_get_args</function>
+ from within a closure.
+ </simpara>
+ </note>
+ </sect2>
+
+ </sect1>
+
+ </chapter>
+
+<!-- Keep this comment at the end of the file
+Local variables:
+mode: sgml
+sgml-omittag:t
+sgml-shorttag:t
+sgml-minimize-attributes:nil
+sgml-always-quote-attributes:t
+sgml-indent-step:1
+sgml-indent-data:t
+indent-tabs-mode:nil
+sgml-parent-document:nil
+sgml-default-dtd-file:"~/.phpdoc/manual.ced"
+sgml-exposed-tags:nil
+sgml-local-catalogs:nil
+sgml-local-ecat-files:nil
+End:
+vim600: syn=xml fen fdm=syntax fdl=2 si
+vim: et tw=78 syn=sgml
+vi: ts=1 sw=1
+-->
=======================================
--- /dev/null
+++ /trunk/xml/language/oop5/iterations.xml Mon Apr 9 09:11:24 2012
@@ -0,0 +1,257 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- $Revision: 324974 $ -->
+<!-- EN-Revision: 324593 Maintainer: HonestQiao Status: ready -->
+<!-- Reviewed: no Maintainer: HonestQiao -->
+<sect1 xml:id="language.oop5.iterations"
xmlns="http://docbook.org/ns/docbook">
+ <title>对象迭代</title>
+ <para>
+
+ PHP 5 provides a way for objects to be defined so it is possible to
iterate
+ through a list of items, with, for example a &foreach; statement. By
default,
+ all <link linkend="language.oop5.visibility">visible</link> properties
will be used
+ for the iteration.
+
+ PHP5提供了一种迭代(iteration)对象的功能,就像使用数组那样,可以通过
&foreach;
+ 来遍历对象中的属性。默认情况下,在外部迭代只能得到外部可见的属性的值。
+ </para>
+
+ <example>
+ <title>简单的对象迭代</title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+class MyClass
+{
+ public $var1 = 'value 1';
+ public $var2 = 'value 2';
+ public $var3 = 'value 3';
+
+ protected $protected = 'protected var';
+ private $private = 'private var';
+
+ function iterateVisible() {
+ echo "MyClass::iterateVisible:\n";
+ foreach($this as $key => $value) {
+ print "$key => $value\n";
+ }
+ }
+}
+
+$class = new MyClass();
+
+foreach($class as $key => $value) {
+ print "$key => $value\n";
+}
+echo "\n";
+
+
+$class->iterateVisible();
+
+?>
+]]>
+ </programlisting>
+ &example.outputs;
+ <screen role="php">
+<![CDATA[
+var1 => value 1
+var2 => value 2
+var3 => value 3
+
+MyClass::iterateVisible:
+var1 => value 1
+var2 => value 2
+var3 => value 3
+protected => protected var
+private => private var
+]]>
+ </screen>
+
+ </example>
+
+ <para>
+ 如上所示, the <link
+ linkend="control-structures.foreach">foreach</link> 遍历了所有
+ <link linkend="language.oop5.visibility">可见的</link> 属性. 你也可以通过
实现PHP 5自带的
+ <varname>Iterator</varname>接口来实现迭代. 使用Iterator接口可以让对象自行
决定如何迭代自已。
+ </para>
+
+ <example>
+ <title>实现Iterator接口的迭代</title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+class MyIterator implements Iterator
+{
+ private $var = array();
+
+ public function __construct($array)
+ {
+ if (is_array($array)) {
+ $this->var = $array;
+ }
+ }
+
+ public function rewind() {
+ echo "rewinding\n";
+ reset($this->var);
+ }
+
+ public function current() {
+ $var = current($this->var);
+ echo "current: $var\n";
+ return $var;
+ }
+
+ public function key() {
+ $var = key($this->var);
+ echo "key: $var\n";
+ return $var;
+ }
+
+ public function next() {
+ $var = next($this->var);
+ echo "next: $var\n";
+ return $var;
+ }
+
+ public function valid() {
+ $var = $this->current() !== false;
+ echo "valid: {$var}\n";
+ return $var;
+ }
+}
+
+$values = array(1,2,3);
+$it = new MyIterator($values);
+
+foreach ($it as $a => $b) {
+ print "$a: $b\n";
+}
+?>
+]]>
+ </programlisting>
+ &example.outputs;
+ <screen role="php">
+<![CDATA[
+rewinding
+current: 1
+valid: 1
+current: 1
+key: 0
+0: 1
+next: 2
+current: 2
+valid: 1
+current: 2
+key: 1
+1: 2
+next: 3
+current: 3
+valid: 1
+current: 3
+key: 2
+2: 3
+next:
+current:
+valid:
+]]>
+ </screen>
+
+ </example>
+
+ <para>
+ 你也可以让类实现<varname>IteratorAggregate</varname>接口,这样你的类就不
用强制性地实现
+ <varname>Iterator</varname>接口中的所有方法。
+ </para>
+
+ <example>
+ <title>通过IteratorAggregate来实现对象迭代</title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+class MyCollection implements IteratorAggregate
+{
+ private $items = array();
+ private $count = 0;
+
+ // Required definition of interface IteratorAggregate
+ public function getIterator() {
+ return new MyIterator($this->items);
+ }
+
+ public function add($value) {
+ $this->items[$this->count++] = $value;
+ }
+}
+
+$coll = new MyCollection();
+$coll->add('value 1');
+$coll->add('value 2');
+$coll->add('value 3');
+
+foreach ($coll as $key => $val) {
+ echo "key/value: [$key -> $val]\n\n";
+}
+?>
+]]>
+ </programlisting>
+ &example.outputs;
+ <screen role="php">
+<![CDATA[
+rewinding
+current: value 1
+valid: 1
+current: value 1
+key: 0
+key/value: [0 -> value 1]
+
+next: value 2
+current: value 2
+valid: 1
+current: value 2
+key: 1
+key/value: [1 -> value 2]
+
+next: value 3
+current: value 3
+valid: 1
+current: value 3
+key: 2
+key/value: [2 -> value 3]
+
+next:
+current:
+valid:
+]]>
+ </screen>
+
+ </example>
+
+ <note>
+ <para>
+ 请查看<link linkend="ref.spl">SPL Extension</link>了解更多Iterator相关
信息。
+ </para>
+ </note>
+
+ </sect1>
+
+<!-- Keep this comment at the end of the file
+Local variables:
+mode: sgml
+sgml-omittag:t
+sgml-shorttag:t
+sgml-minimize-attributes:nil
+sgml-always-quote-attributes:t
+sgml-indent-step:1
+sgml-indent-data:t
+indent-tabs-mode:nil
+sgml-parent-document:nil
+sgml-default-dtd-file:"~/.phpdoc/manual.ced"
+sgml-exposed-tags:nil
+sgml-local-catalogs:nil
+sgml-local-ecat-files:nil
+End:
+vim600: syn=xml fen fdm=syntax fdl=2 si
+vim: et tw=78 syn=sgml
+vi: ts=1 sw=1
+-->
=======================================
--- /dev/null
+++ /trunk/xml/language/oop5.xml Mon Apr 9 09:11:24 2012
@@ -0,0 +1,78 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- $Revision: 324974 $ -->
+<!-- EN-Revision: 313564 Maintainer: HonestQiao Status: ready -->
+<!-- Reviewed: no Maintainer: HonestQiao -->
+<!-- CREDITS: dallas -->
+ <chapter xml:id="language.oop5" xmlns="http://docbook.org/ns/docbook">
+ <title>类与对象</title>
+
+ <sect1 xml:id="op5.intro">
+ <title>前言</title>
+ <para>
+ PHP 5 引入了新的对象模型(Object Model)。完全重写了
+ PHP 处理对象的方式,允许更佳性能和更多特性。
+ </para>
+
+ <para>
+ PHP5中的新特性包括
+ <link linkend="language.oop5.visibility">可见性</link>,
+ <link linkend="language.oop5.abstract">抽象类</link> 和
+ <link linkend="language.oop5.final">final</link> 类、类方法,
+ <link linkend="language.oop5.magic">魔术方法</link>,
+ <link linkend="language.oop5.interfaces">接口</link>,
+ <link linkend="language.oop5.cloning">对象克隆</link> 和
+ <link linkend="language.oop5.typehinting">类型提示</link>.
+ </para>
+ <para>
+ PHP当中对象是按引用传递的,即每个包含对象的变量都持有对象的引用
(reference),而不是整个对象的拷贝。
+ 请参阅<link linkend="language.oop5.references">对象与引用</link>
+ </para>
+ &tip.userlandnaming;
+ </sect1>
+
+ &language.oop5.basic;
+ &language.oop5.properties;
+ &language.oop5.constants;
+ &language.oop5.autoload;
+ &language.oop5.decon;
+ &language.oop5.visibility;
+ &language.oop5.inheritance;
+ &language.oop5.paamayim-nekudotayim;
+ &language.oop5.static;
+ &language.oop5.abstract;
+ &language.oop5.interfaces;
+ &language.oop5.traits;
+ &language.oop5.overloading;
+ &language.oop5.iterations;
+ &language.oop5.patterns;
+ &language.oop5.magic;
+ &language.oop5.final;
+ &language.oop5.cloning;
+ &language.oop5.object-comparison;
+ &language.oop5.typehinting;
+ &language.oop5.late-static-bindings;
+ &language.oop5.references;
+ &language.oop5.serialization;
+ &language.oop5.changelog;
+</chapter>
+
+<!-- Keep this comment at the end of the file
+Local variables:
+mode: sgml
+sgml-omittag:t
+sgml-shorttag:t
+sgml-minimize-attributes:nil
+sgml-always-quote-attributes:t
+sgml-indent-step:1
+sgml-indent-data:t
+indent-tabs-mode:nil
+sgml-parent-document:nil
+sgml-default-dtd-file:"~/.phpdoc/manual.ced"
+sgml-exposed-tags:nil
+sgml-local-catalogs:nil
+sgml-local-ecat-files:nil
+End:
+vim600: syn=xml fen fdm=syntax fdl=2 si
+vim: et tw=78 syn=sgml
+vi: ts=1 sw=1
+-->
=======================================
--- /dev/null
+++ /trunk/xml/language/operators.xml Mon Apr 9 09:11:24 2012
@@ -0,0 +1,1692 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- $Revision: 324974 $ -->
+<!-- EN-Revision: 324522 Maintainer: HonestQiao Status: ready -->
+<!-- Reviewed: no Maintainer: HonestQiao -->
+<!-- CREDITS: dallas -->
+ <chapter xml:id="language.operators"
xmlns="http://docbook.org/ns/docbook">
+ <title>运算符</title>
+ <simpara>
+ 运算符是可以通过给出的一或多个值(用编程行话来说,表达式)来产生另一个值
(因而整个结构成为一个表达式)的东西。所以可以认为函数或任何会返回一个值(例

+ print)的结构是运算符,而那些没有返回值的(例如 echo)是别的东西。
+ </simpara>
+ <para>
+ 有三种类型的运算符。第一种是一元运算符,只运算一个值,例如
+ !(取反运算符)或 ++(加一运算符)。第二种是有限二元运算符,PHP
+ 支持的大多数运算符都是这种。列表见下节<link
+ linkend="language.operators.precedence">运算符优先级</link>。
+ </para>
+ <para>
+ 第三种是三元运算符:?:。它应该被用来根据一个表达式在另两个表达式中选择一
个,而不是用来在两个语句或者程序路线中选择。把整个三元表达式放在扩号里是个很
好的主意。
+ </para>
+
+ <sect1 xml:id="language.operators.precedence">
+ <title>运算符优先级</title>
+ <para>
+ 运算符优先级指定了两个表达式绑定得有多"紧密"。例如,表达式 <literal>1
+ 5 *
+ 3</literal> 的结果是 <literal>16</literal> 而不是 <literal>18</literal>
+ 是因为乘号("*")的优先级比加号("+")高。必要时可以用括号来强制改变优
先级。例如:<literal>(1
+ + 5) * 3</literal> 的值为 <literal>18</literal>。如果运算符优先级相
同,则使用从左到右的左联顺序。
+ </para>
+ <para>
+ 下表从高到低列出了运算符的优先级。同一行中的运算符具有相同优先级,此时
它们的结合方向决定求值顺序。
+ <table>
+ <title>运算符优先级</title>
+ <tgroup cols="2">
+ <thead>
+ <row>
+ <entry>结合方向</entry>
+ <entry>运算符</entry>
+ <entry>附加信息</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>非结合</entry>
+ <entry>clone new</entry>
+ <entry><link linkend="language.oop5.cloning">clone</link> 和 <link
linkend="language.oop5.basic.new">new</link></entry>
+ </row>
+ <row>
+ <entry>左</entry>
+ <entry>[</entry>
+ <entry><function>array</function></entry>
+ </row>
+ <row>
+ <entry>非结合</entry>
+ <entry>++ --</entry>
+ <entry>
+ <link linkend="language.operators.increment">递增/递减运算符
</link>
+ </entry>
+ </row>
+ <row>
+ <entry>非结合</entry>
+ <entry>~ - (int) (float) (string) (array) (object) (bool) @</entry>
+ <entry>
+ <link linkend="language.types">类型</link>
+ </entry>
+ </row>
+ <row>
+ <entry>非结合</entry>
+ <entry>instanceof</entry>
+ <entry>
+ <link linkend="language.types">类型</link>
+ </entry>
+ </row>
+ <row>
+ <entry>右结合</entry>
+ <entry>!</entry>
+ <entry>
+ <link linkend="language.operators.logical">逻辑操作符</link>
+ </entry>
+ </row>
+ <row>
+ <entry>左</entry>
+ <entry>* / %</entry>
+ <entry>
+ <link linkend="language.operators.arithmetic">算术运算符</link>
+ </entry>
+ </row>
+ <row>
+ <entry>左</entry>
+ <entry>+ - .</entry>
+ <entry>
+ <link linkend="language.operators.arithmetic">算术运算符
</link>&listendand;<link
+ linkend="language.operators.string">字符串运算符</link></entry>
+ </row>
+ <row>
+ <entry>左</entry>
+ <entry>&lt;&lt; &gt;&gt;</entry>
+ <entry>
+ <link linkend="language.operators.bitwise">位运算符</link>
+ </entry>
+ </row>
+ <row>
+ <entry>非结合</entry>
+ <entry>&lt; &lt;= &gt; &gt;= &lt;&gt;</entry>
+ <entry>
+ <link linkend="language.operators.comparison">比较运算符</link>
+ </entry>
+ </row>
+ <row>
+ <entry>非结合</entry>
+ <entry>== != === !==</entry>
+ <entry>
+ <link linkend="language.operators.comparison">比较运算符</link>
+ </entry>
+ </row>
+ <row>
+ <entry>左</entry>
+ <entry>&amp;</entry>
+ <entry>
+ <link linkend="language.operators.bitwise">位运算符
</link>&listendand;<link
+ linkend="language.references">引用</link></entry>
+ </row>
+ <row>
+ <entry>左</entry>
+ <entry>^</entry>
+ <entry>
+ <link linkend="language.operators.bitwise">位运算符</link>
+ </entry>
+ </row>
+ <row>
+ <entry>左</entry>
+ <entry>|</entry>
+ <entry>
+ <link linkend="language.operators.bitwise">位运算符</link>
+ </entry>
+ </row>
+ <row>
+ <entry>左</entry>
+ <entry>&amp;&amp;</entry>
+ <entry>
+ <link linkend="language.operators.logical">逻辑运算符</link>
+ </entry>
+ </row>
+ <row>
+ <entry>左</entry>
+ <entry>||</entry>
+ <entry>
+ <link linkend="language.operators.logical">逻辑运算符</link>
+ </entry>
+ </row>
+ <row>
+ <entry>左</entry>
+ <entry>? :</entry>
+ <entry>
+ <link linkend="language.operators.comparison.ternary">三元运算符
</link>
+ </entry>
+ </row>
+ <row>
+ <entry>右</entry>
+ <entry>
+ = += -= *= /= .= %= &amp;= |= ^= &lt;&lt;= &gt;&gt;=
+ </entry>
+ <entry>
+ <link linkend="language.operators.assignment">赋值运算符</link>
+ </entry>
+ </row>
+ <row>
+ <entry>左</entry>
+ <entry>and</entry>
+ <entry>
+ <link linkend="language.operators.logical">逻辑运算符</link>
+ </entry>
+ </row>
+ <row>
+ <entry>左</entry>
+ <entry>xor</entry>
+ <entry>
+ <link linkend="language.operators.logical">逻辑运算符</link>
+ </entry>
+ </row>
+ <row>
+ <entry>左</entry>
+ <entry>or</entry>
+ <entry>
+ <link linkend="language.operators.logical">逻辑运算符</link>
+ </entry>
+ </row>
+ <row>
+ <entry>左</entry>
+ <entry>,</entry>
+ <entry>多处用到</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ </para>
+ <para>
+ 左联表示表达式从左向右求值,右联相反。
+ <example>
+ <title>结合方向</title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+$a = 3 * 3 % 5; // (3 * 3) % 5 = 4
+$a = true ? 0 : true ? 1 : 2; // (true ? 0 : true) ? 1 : 2 = 2
+
+$a = 1;
+$b = 2;
+$a = $b += 3; // $a = ($b += 3) -> $a = 5, $b = 5
+?>
+]]>
+ </programlisting>
+ </example>
+ 使用括号可以增强代码的可读性。
+ </para>
+ <note>
+ <para>
+ 尽管 <literal>=</literal> 比其它大多数的运算符的优先级低,PHP
+ 仍旧允许类似如下的表达式:<literal>if (!$a = foo())</literal>,在此例

+ <literal>foo()</literal> 的返回值被赋给了 <varname>$a</varname>。
+ </para>
+ </note>
+ </sect1>
+
+ <sect1 xml:id="language.operators.arithmetic">
+ <title>算术运算符</title>
+ <simpara>
+ 还记得学校里学到的基本数学知识吗?就和它们一样。
+ </simpara>
+ <table>
+ <title>算术运算符</title>
+ <tgroup cols="3">
+ <thead>
+ <row>
+ <entry>例子</entry>
+ <entry>名称</entry>
+ <entry>结果</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>-$a</entry>
+ <entry>取反</entry>
+ <entry>$a 的负值。</entry>
+ </row>
+ <row>
+ <entry>$a + $b</entry>
+ <entry>加法</entry>
+ <entry>$a 和 $b 的和。</entry>
+ </row>
+ <row>
+ <entry>$a - $b</entry>
+ <entry>减法</entry>
+ <entry>$a 和 $b 的差。</entry>
+ </row>
+ <row>
+ <entry>$a * $b</entry>
+ <entry>乘法</entry>
+ <entry>$a 和 $b 的积。</entry>
+ </row>
+ <row>
+ <entry>$a / $b</entry>
+ <entry>除法</entry>
+ <entry>$a 除以 $b 的商。</entry>
+ </row>
+ <row>
+ <entry>$a % $b</entry>
+ <entry>取模</entry>
+ <entry>$a 除以 $b 的余数。</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ <simpara>
+ 除法运算符总是返回浮点数。只有在下列情况例外:两个操作数都是整数(或字
符串转换成的整数)并且正好能整除,这时它返回一个整数。
+ </simpara>
+ <simpara>
+ 取模运算符的操作数在运算之前都会转换成整数(除去小数部分)。
+ </simpara>
+ <note>
+ <simpara>
+ 取模 <literal>$a % $b</literal> 在 <literal>$a</literal>
+ 为负值时的结果也是负值。
+ </simpara>
+ </note>
+ <simpara>
+ 参见手册中的<link linkend="ref.math">数学函数</link>。
+ </simpara>
+
+ </sect1>
+
+ <sect1 xml:id="language.operators.assignment">
+ <title>赋值运算符</title>
+ <simpara>
+ 基本的赋值运算符是"="。一开始可能会以为它是"等于",其实不是的。它实际上
意味着把右边表达式的值赋给左边的运算数。
+ </simpara>
+ <para>
+ 赋值运算表达式的值也就是所赋的值。也就是说,"$a = 3"的值是 3。这样就可
以做一些小技巧:
+ <informalexample>
+ <programlisting role="php">
+<![CDATA[
+<?php
+
+$a = ($b = 4) + 5; // $a 现在成了 9,而 $b 成了 4。
+
+?>
+]]>
+ </programlisting>
+ </informalexample>
+ </para>
+ <para>
+ 在基本赋值运算符之外,还有适合于所有<link
+ linkend="language.operators">二元算术</link>,数组集合和字符串运算符的
"组合运算符",这样可以在一个表达式中使用它的值并把表达式的结果赋给它,例如:
+ <informalexample>
+ <programlisting role="php">
+<![CDATA[
+<?php
+
+$a = 3;
+$a += 5; // sets $a to 8, as if we had said: $a = $a + 5;
+$b = "Hello ";
+$b .= "There!"; // sets $b to "Hello There!", just like $b = $b . "There!";
+
+?>
+]]>
+ </programlisting>
+ </informalexample>
+ </para>
+ <para>
+ 注意赋值运算将原变量的值拷贝到新变量中(传值赋值),所以改变其中一个并
不影响另一个。这也适合于在很密集的循环中拷贝一些值例如大数组。也可以使用引用
赋值,用 <computeroutput>$var =
+ &amp;$othervar;</computeroutput> 语法。引用赋值意味着两个变量都指向同一
个数据,没有任何数据的拷贝。有关引用的更多信息见<link
+ linkend="language.references">引用的说明</link>。在
+ PHP 5中,对象总是通过引用赋值的,除非明确使用新的 <link
+ linkend="language.oop5.cloning">clone</link>关键字。
+ </para>
+ </sect1>
+
+ <sect1 xml:id="language.operators.bitwise">
+ <title>位运算符</title>
+ <simpara>
+ 位运算符允许对整型数中指定的位进行置位。如果左右参数都是字符串,则位运
算符将操作字符的
+ ASCII 值。
+ </simpara>
+ <para>
+ <informalexample>
+ <programlisting role="php">
+<![CDATA[
+<?php
+echo 12 ^ 9; // 输出为 '5'
+
+echo "12" ^ "9"; // 输出退格字符(ascii 8)
+ // ('1' (ascii 49)) ^ ('9' (ascii 57)) = #8
+
+echo "hallo" ^ "hello"; // 输出 ascii 值 #0 #4 #0 #0 #0
+ // 'a' ^ 'e' = #4
+
+echo 2 ^ "3"; // 输出 1
+ // 2 ^ ((int)"3") == 1
+
+echo "2" ^ 3; // 输出 1
+ // ((int)"2") ^ 3 == 1
+?>
+]]>
+ </programlisting>
+ </informalexample>
+ </para>
+
+ <table>
+ <title>位运算符</title>
+ <tgroup cols="3">
+ <thead>
+ <row>
+ <entry>例子</entry>
+ <entry>名称</entry>
+ <entry>结果</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>$a &amp; $b</entry>
+ <entry>And(按位与)</entry>
+ <entry>将把 $a 和 $b 中都为 1 的位设为 1。</entry>
+ </row>
+ <row>
+ <entry>$a | $b</entry>
+ <entry>Or(按位或)</entry>
+ <entry>将把 $a 或者 $b 中为 1 的位设为 1。</entry>
+ </row>
+ <row>
+ <entry>$a ^ $b</entry>
+ <entry>Xor(按位异或)</entry>
+ <entry>将把 $a 和 $b 中不同的位设为 1。</entry>
+ </row>
+ <row>
+ <entry>~ $a</entry>
+ <entry>Not(按位非)</entry>
+ <entry>将 $a 中为 0 的位设为 1,反之亦然。</entry>
+ </row>
+ <row>
+ <entry>$a &lt;&lt; $b</entry>
+ <entry>Shift left(左移)</entry>
+ <entry>将 $a 中的位向左移动 $b 次(每一次移动都表示"乘以 2")。
</entry>
+ </row>
+ <row>
+ <entry>$a &gt;&gt; $b</entry>
+ <entry>Shift right(右移)</entry>
+ <entry>将 $a 中的位向右移动 $b 次(每一次移动都表示"除以 2")。
</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ <para>
+ <example>
+ <title>Bit shifting on integers</title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+/*
+ * Here are the examples.
+ */
+
+echo "\n--- BIT SHIFT RIGHT ON POSITIVE INTEGERS ---\n";
+
+$val = 4;
+$places = 1;
+$res = $val >> $places;
+p($res, $val, '>>', $places, 'copy of sign bit shifted into left side');
+
+$val = 4;
+$places = 2;
+$res = $val >> $places;
+p($res, $val, '>>', $places);
+
+$val = 4;
+$places = 3;
+$res = $val >> $places;
+p($res, $val, '>>', $places, 'bits shift out right side');
+
+$val = 4;
+$places = 4;
+$res = $val >> $places;
+p($res, $val, '>>', $places, 'same result as above; can not shift beyond
0');
+
+
+echo "\n--- BIT SHIFT RIGHT ON NEGATIVE INTEGERS ---\n";
+
+$val = -4;
+$places = 1;
+$res = $val >> $places;
+p($res, $val, '>>', $places, 'copy of sign bit shifted into left side');
+
+$val = -4;
+$places = 2;
+$res = $val >> $places;
+p($res, $val, '>>', $places, 'bits shift out right side');
+
+$val = -4;
+$places = 3;
+$res = $val >> $places;
+p($res, $val, '>>', $places, 'same result as above; can not shift beyond
-1');
+
+
+echo "\n--- BIT SHIFT LEFT ON POSITIVE INTEGERS ---\n";
+
+$val = 4;
+$places = 1;
+$res = $val << $places;
+p($res, $val, '<<', $places, 'zeros fill in right side');
+
+$val = 4;
+$places = (PHP_INT_SIZE * 8) - 4;
+$res = $val << $places;
+p($res, $val, '<<', $places);
+
+$val = 4;
+$places = (PHP_INT_SIZE * 8) - 3;
+$res = $val << $places;
+p($res, $val, '<<', $places, 'sign bits get shifted out');
+
+$val = 4;
+$places = (PHP_INT_SIZE * 8) - 2;
+$res = $val << $places;
+p($res, $val, '<<', $places, 'bits shift out left side');
+
+
+echo "\n--- BIT SHIFT LEFT ON NEGATIVE INTEGERS ---\n";
+
+$val = -4;
+$places = 1;
+$res = $val << $places;
+p($res, $val, '<<', $places, 'zeros fill in right side');
+
+$val = -4;
+$places = (PHP_INT_SIZE * 8) - 3;
+$res = $val << $places;
+p($res, $val, '<<', $places);
+
+$val = -4;
+$places = (PHP_INT_SIZE * 8) - 2;
+$res = $val << $places;
+p($res, $val, '<<', $places, 'bits shift out left side, including sign
bit');
+
+
+/*
+ * Ignore this bottom section,
+ * it is just formatting to make output clearer.
+ */
+
+function p($res, $val, $op, $places, $note = '') {
+ $format = '%0' . (PHP_INT_SIZE * 8) . "b\n";
+
+ printf("Expression: %d = %d %s %d\n", $res, $val, $op, $places);
+
+ echo " Decimal:\n";
+ printf(" val=%d\n", $val);
+ printf(" res=%d\n", $res);
+
+ echo " Binary:\n";
+ printf(' val=' . $format, $val);
+ printf(' res=' . $format, $res);
+
+ if ($note) {
+ echo " NOTE: $note\n";
+ }
+
+ echo "\n";
+}
+?>
+]]>
+ </programlisting>
+ &example.outputs.32bit;
+ <screen>
+<![CDATA[
+
+--- BIT SHIFT RIGHT ON POSITIVE INTEGERS ---
+Expression: 2 = 4 >> 1
+ Decimal:
+ val=4
+ res=2
+ Binary:
+ val=00000000000000000000000000000100
+ res=00000000000000000000000000000010
+ NOTE: copy of sign bit shifted into left side
+
+Expression: 1 = 4 >> 2
+ Decimal:
+ val=4
+ res=1
+ Binary:
+ val=00000000000000000000000000000100
+ res=00000000000000000000000000000001
+
+Expression: 0 = 4 >> 3
+ Decimal:
+ val=4
+ res=0
+ Binary:
+ val=00000000000000000000000000000100
+ res=00000000000000000000000000000000
+ NOTE: bits shift out right side
+
+Expression: 0 = 4 >> 4
+ Decimal:
+ val=4
+ res=0
+ Binary:
+ val=00000000000000000000000000000100
+ res=00000000000000000000000000000000
+ NOTE: same result as above; can not shift beyond 0
+
+
+--- BIT SHIFT RIGHT ON NEGATIVE INTEGERS ---
+Expression: -2 = -4 >> 1
+ Decimal:
+ val=-4
+ res=-2
+ Binary:
+ val=11111111111111111111111111111100
+ res=11111111111111111111111111111110
+ NOTE: copy of sign bit shifted into left side
+
+Expression: -1 = -4 >> 2
+ Decimal:
+ val=-4
+ res=-1
+ Binary:
+ val=11111111111111111111111111111100
+ res=11111111111111111111111111111111
+ NOTE: bits shift out right side
+
+Expression: -1 = -4 >> 3
+ Decimal:
+ val=-4
+ res=-1
+ Binary:
+ val=11111111111111111111111111111100
+ res=11111111111111111111111111111111
+ NOTE: same result as above; can not shift beyond -1
+
+
+--- BIT SHIFT LEFT ON POSITIVE INTEGERS ---
+Expression: 8 = 4 << 1
+ Decimal:
+ val=4
+ res=8
+ Binary:
+ val=00000000000000000000000000000100
+ res=00000000000000000000000000001000
+ NOTE: zeros fill in right side
+
+Expression: 1073741824 = 4 << 28
+ Decimal:
+ val=4
+ res=1073741824
+ Binary:
+ val=00000000000000000000000000000100
+ res=01000000000000000000000000000000
+
+Expression: -2147483648 = 4 << 29
+ Decimal:
+ val=4
+ res=-2147483648
+ Binary:
+ val=00000000000000000000000000000100
+ res=10000000000000000000000000000000
+ NOTE: sign bits get shifted out
+
+Expression: 0 = 4 << 30
+ Decimal:
+ val=4
+ res=0
+ Binary:
+ val=00000000000000000000000000000100
+ res=00000000000000000000000000000000
+ NOTE: bits shift out left side
+
+
+--- BIT SHIFT LEFT ON NEGATIVE INTEGERS ---
+Expression: -8 = -4 << 1
+ Decimal:
+ val=-4
+ res=-8
+ Binary:
+ val=11111111111111111111111111111100
+ res=11111111111111111111111111111000
+ NOTE: zeros fill in right side
+
+Expression: -2147483648 = -4 << 29
+ Decimal:
+ val=-4
+ res=-2147483648
+ Binary:
+ val=11111111111111111111111111111100
+ res=10000000000000000000000000000000
+
+Expression: 0 = -4 << 30
+ Decimal:
+ val=-4
+ res=0
+ Binary:
+ val=11111111111111111111111111111100
+ res=00000000000000000000000000000000
+ NOTE: bits shift out left side, including sign bit
+]]>
+ </screen>
+ &example.outputs.64bit;
+ <screen>
+<![CDATA[
+
+--- BIT SHIFT RIGHT ON POSITIVE INTEGERS ---
+Expression: 2 = 4 >> 1
+ Decimal:
+ val=4
+ res=2
+ Binary:
+ val=0000000000000000000000000000000000000000000000000000000000000100
+ res=0000000000000000000000000000000000000000000000000000000000000010
+ NOTE: copy of sign bit shifted into left side
+
+Expression: 1 = 4 >> 2
+ Decimal:
+ val=4
+ res=1
+ Binary:
+ val=0000000000000000000000000000000000000000000000000000000000000100
+ res=0000000000000000000000000000000000000000000000000000000000000001
+
+Expression: 0 = 4 >> 3
+ Decimal:
+ val=4
+ res=0
+ Binary:
+ val=0000000000000000000000000000000000000000000000000000000000000100
+ res=0000000000000000000000000000000000000000000000000000000000000000
+ NOTE: bits shift out right side
+
+Expression: 0 = 4 >> 4
+ Decimal:
+ val=4
+ res=0
+ Binary:
+ val=0000000000000000000000000000000000000000000000000000000000000100
+ res=0000000000000000000000000000000000000000000000000000000000000000
+ NOTE: same result as above; can not shift beyond 0
+
+
+--- BIT SHIFT RIGHT ON NEGATIVE INTEGERS ---
+Expression: -2 = -4 >> 1
+ Decimal:
+ val=-4
+ res=-2
+ Binary:
+ val=1111111111111111111111111111111111111111111111111111111111111100
+ res=1111111111111111111111111111111111111111111111111111111111111110
+ NOTE: copy of sign bit shifted into left side
+
+Expression: -1 = -4 >> 2
+ Decimal:
+ val=-4
+ res=-1
+ Binary:
+ val=1111111111111111111111111111111111111111111111111111111111111100
+ res=1111111111111111111111111111111111111111111111111111111111111111
+ NOTE: bits shift out right side
+
+Expression: -1 = -4 >> 3
+ Decimal:
+ val=-4
+ res=-1
+ Binary:
+ val=1111111111111111111111111111111111111111111111111111111111111100
+ res=1111111111111111111111111111111111111111111111111111111111111111
+ NOTE: same result as above; can not shift beyond -1
+
+
+--- BIT SHIFT LEFT ON POSITIVE INTEGERS ---
+Expression: 8 = 4 << 1
+ Decimal:
+ val=4
+ res=8
+ Binary:
+ val=0000000000000000000000000000000000000000000000000000000000000100
+ res=0000000000000000000000000000000000000000000000000000000000001000
+ NOTE: zeros fill in right side
+
+Expression: 4611686018427387904 = 4 << 60
+ Decimal:
+ val=4
+ res=4611686018427387904
+ Binary:
+ val=0000000000000000000000000000000000000000000000000000000000000100
+ res=0100000000000000000000000000000000000000000000000000000000000000
+
+Expression: -9223372036854775808 = 4 << 61
+ Decimal:
+ val=4
+ res=-9223372036854775808
+ Binary:
+ val=0000000000000000000000000000000000000000000000000000000000000100
+ res=1000000000000000000000000000000000000000000000000000000000000000
+ NOTE: sign bits get shifted out
+
+Expression: 0 = 4 << 62
+ Decimal:
+ val=4
+ res=0
+ Binary:
+ val=0000000000000000000000000000000000000000000000000000000000000100
+ res=0000000000000000000000000000000000000000000000000000000000000000
+ NOTE: bits shift out left side
+
+
+--- BIT SHIFT LEFT ON NEGATIVE INTEGERS ---
+Expression: -8 = -4 << 1
+ Decimal:
+ val=-4
+ res=-8
+ Binary:
+ val=1111111111111111111111111111111111111111111111111111111111111100
+ res=1111111111111111111111111111111111111111111111111111111111111000
+ NOTE: zeros fill in right side
+
+Expression: -9223372036854775808 = -4 << 61
+ Decimal:
+ val=-4
+ res=-9223372036854775808
+ Binary:
+ val=1111111111111111111111111111111111111111111111111111111111111100
+ res=1000000000000000000000000000000000000000000000000000000000000000
+
+Expression: 0 = -4 << 62
+ Decimal:
+ val=-4
+ res=0
+ Binary:
+ val=1111111111111111111111111111111111111111111111111111111111111100
+ res=0000000000000000000000000000000000000000000000000000000000000000
+ NOTE: bits shift out left side, including sign bit
+]]>
+ </screen>
+ </example>
+ </para>
+ <warning>
+ <para>
+ 在 32 位系统上不要右移超过 32 位。不要在结果可能超过 32 位的情况下左
移。
+ </para>
+ </warning>
+ </sect1>
+
+ <sect1 xml:id="language.operators.comparison">
+ <title>比较运算符</title>
+ <simpara>
+ 比较运算符,如同它们名称所暗示的,允许对两个值进行比较。还可以参考
+ <link linkend="types.comparisons">PHP 类型比较表</link>看不同类型相互比
较的例子。
+ </simpara>
+ <table>
+ <title>比较运算符</title>
+ <tgroup cols="3">
+ <thead>
+ <row>
+ <entry>例子</entry>
+ <entry>名称</entry>
+ <entry>结果</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>$a == $b</entry>
+ <entry>等于</entry>
+ <entry>&true;,如果 $a 等于 $b。</entry>
+ </row>
+ <row>
+ <entry>$a === $b</entry>
+ <entry>全等</entry>
+ <entry>&true;,如果 $a 等于 $b,并且它们的类型也相同。(PHP 4 引进
)</entry>
+ </row>
+ <row>
+ <entry>$a != $b</entry>
+ <entry>不等</entry>
+ <entry>&true;,如果 $a 不等于 $b。</entry>
+ </row>
+ <row>
+ <entry>$a &lt;&gt; $b</entry>
+ <entry>不等</entry>
+ <entry>&true;,如果 $a 不等于 $b。</entry>
+ </row>
+ <row>
+ <entry>$a !== $b</entry>
+ <entry>非全等</entry>
+ <entry>&true;,如果 $a 不等于 $b,或者它们的类型不同。(PHP 4 引进
)</entry>
+ </row>
+ <row>
+ <entry>$a &lt; $b</entry>
+ <entry>小与</entry>
+ <entry>&true;,如果 $a 严格小于 $b。</entry>
+ </row>
+ <row>
+ <entry>$a &gt; $b</entry>
+ <entry>大于</entry>
+ <entry>&true;,如果 $a 严格 $b。</entry>
+ </row>
+ <row>
+ <entry>$a &lt;= $b</entry>
+ <entry>小于等于</entry>
+ <entry>&true;,如果 $a 小于或者等于 $b。</entry>
+ </row>
+ <row>
+ <entry>$a &gt;= $b</entry>
+ <entry>大于等于</entry>
+ <entry>&true;,如果 $a 大于或者等于 $b。</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ <para>
+ 如果比较一个整数和字符串,则字符串会被<link
+ linkend="language.types.string.conversion">转换为整数</link>。如果比较
两个数字字符串,则作为整数比较。此规则也适用于
+ <link linkend="control-structures.switch">switch</link> 语句。
+ <informalexample>
+ <programlisting role="php">
+<![CDATA[
+<?php
+var_dump(0 == "a"); // 0 == 0 -> true
+var_dump("1" == "01"); // 1 == 1 -> true
+var_dump("1" == "1e0"); // 1 == 1 -> true
+switch ("a") {
+case 0:
+ echo "0";
+ break;
+case "a": // never reached because "a" is already matched with 0
+ echo "a";
+ break;
+}
+?>
+]]>
+ </programlisting>
+ </informalexample>
+ </para>
+
+ <para>
+ 对于多种类型,比较运算符根据下表比较(按顺序)。
+ </para>
+ <table xml:id="language.operators.comparison.types">
+ <title>比较多种类型</title>
+ <tgroup cols="3">
+ <thead>
+ <row>
+ <entry>运算数 1 类型</entry>
+ <entry>运算数 1 类型</entry>
+ <entry>结果</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry><type>null</type> 或 <type>string</type></entry>
+ <entry><type>string</type></entry>
+ <entry>将 &null; 转换为 "",进行数字或词汇比较</entry>
+ </row>
+ <row>
+ <entry><type>bool</type> 或 <type>null</type></entry>
+ <entry>任何其它类型</entry>
+ <entry>转换为 <type>bool</type>,&false; &lt; &true;</entry>
+ </row>
+ <row>
+ <entry><type>object</type></entry>
+ <entry><type>object</type></entry>
+ <entry>
+ 内置类可以定义自己的比较,不同类不能比较,相同类和数组同样方式比较
属性(PHP
+ 4 中),PHP 5 有其自己的<link
+ linkend="language.oop5.object-comparison">说明</link>
+ </entry>
+ </row>
+ <row>
+ <entry><type>string</type>,<type>resource</type> 或
<type>number</type></entry>
+ <entry><type>string</type>,<type>resource</type> 或
<type>number</type></entry>
+ <entry>将字符串和资源转换成数字,按普通数学比较</entry>
+ </row>
+ <row>
+ <entry><type>array</type></entry>
+ <entry><type>array</type></entry>
+ <entry>
+ 具有较少成员的数组较小,如果运算数 1 中的键不存在于运算数
+ 2 中则数组无法比较,否则挨个值比较(见下例)
+ </entry>
+ </row>
+ <row>
+ <entry><type>array</type></entry>
+ <entry>任何其它类型</entry>
+ <entry><type>array</type> 总是更大</entry>
+ </row>
+ <row>
+ <entry><type>object</type></entry>
+ <entry>任何其它类型</entry>
+ <entry><type>object</type> 总是更大</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ <para>
+ <example>
+ <title>标准数组比较代码</title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+// 数组是用标准比较运算符这样比较的
+function standard_array_compare($op1, $op2)
+{
+ if (count($op1) < count($op2)) {
+ return -1; // $op1 < $op2
+ } elseif (count($op1) > count($op2)) {
+ return 1; // $op1 > $op2
+ }
+ foreach ($op1 as $key => $val) {
+ if (!array_key_exists($key, $op2)) {
+ return null; // uncomparable
+ } elseif ($val < $op2[$key]) {
+ return -1;
+ } elseif ($val > $op2[$key]) {
+ return 1;
+ }
+ }
+ return 0; // $op1 == $op2
+}
+?>
+]]>
+ </programlisting>
+ </example>
+ </para>
+
+ <para>
+ 参见
<function>strcasecmp</function>,<function>strcmp</function>,<link
+ linkend="language.operators.array">数组运算符</link>和<link
linkend="language.types">类型</link>一章。
+ </para>
+
+ <sect2 xml:id="language.operators.comparison.ternary">
+ <title>三元运算符</title>
+ <para>
+ 另一个条件运算符是"?:"(或三元)运算符 。
***The diff for this file has been truncated for email.***
=======================================
--- /dev/null
+++ /trunk/xml/language/types/array.xml Mon Apr 9 09:11:24 2012
@@ -0,0 +1,854 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- $Revision: 324974 $ -->
+<!-- EN-Revision: 324720 Maintainer: HonestQiao Status: ready -->
+<!-- Reviewed: no Maintainer: HonestQiao -->
+<!-- CREDITS: Geogory dallas -->
+<sect1 xml:id="language.types.array">
+ <title>数组</title>
+
+ <para>
+ PHP 中的 <type>数组</type> 实际上是一个有序映射。映射是一种把
<emphasis>values</emphasis>
+ 关联到 <emphasis>keys</emphasis> 的类型。此类型在很多方面做了优化,因此
可以把它当成真正的数组,或列表(向量),散列表(是映射的一种实现),字典,集
合,栈,队列以及更多可能性。数组元素的值也可以是另一个数组。树形结构和多维数
组也是允许的。
+ </para>
+
+ <para>
+ 解释这些结构超出了本手册的范围,但对于每种结构至少会提供一个例子。要得到
这些结构的更多信息,建议参考有关此广阔主题的其它著作。
+ </para>
+
+ <sect2 xml:id="language.types.array.syntax">
+ <title>语法</title>
+
+ <sect3 xml:id="language.types.array.syntax.array-func">
+ <title>定义数组 <function>array</function></title>
+
+ <para>
+ 可以用 <function>array</function> 语言结构来新建一个
<type>array</type>。它接受任意数量用逗号分隔的
+ <literal><replaceable>键(key)</replaceable> =&gt; <replaceable>值
(value)</replaceable></literal> 对。
+ </para>
+
+ <synopsis>
+array( <optional> <replaceable>key</replaceable> =&gt; </optional>
<replaceable>value</replaceable>
+ , ...
+ )
+// <replaceable>键(key)</replaceable> 可是是一个 <type>整数
(integer)</type> 或 <type>字符串(string)</type>
+// <replaceable>值(value)</replaceable> 可以是任意类型的值</synopsis>
+ <!-- Do not fix the whitespace for the synopsis end element. A
limitation of PhD prevents proper trimming -->
+
+ <informalexample>
+ <programlisting role="php">
+<![CDATA[
+<?php
+$arr = array("foo" => "bar", 12 => true);
+
+echo $arr["foo"]; // bar
+echo $arr[12]; // 1
+?>
+]]>
+ </programlisting>
+ &example.outputs.53;
+ <screen>
+<![CDATA[
+string(1) "b"
+bool(true)
+string(1) "b"
+bool(true)
+string(1) "a"
+bool(true)
+string(1) "b"
+bool(true)
+]]>
+ </screen>
+ &example.outputs.54;
+ <screen>
+<![CDATA[
+string(1) "b"
+bool(true)
+
+Warning: Illegal string offset '1.0' in /tmp/t.php on line 7
+string(1) "b"
+bool(false)
+
+Warning: Illegal string offset 'x' in /tmp/t.php on line 9
+string(1) "a"
+bool(false)
+string(1) "b"
+bool(false)
+]]>
+ </screen>
+ </informalexample>
+
+ <para>
+ <varname>key</varname> 可以是 <type>integer</type> 或者
<type>string</type>。如果key是一个
+ <type>integer</type> 的标准表示,则被解释为整数(例如
<literal>"8"</literal> 将被解释为
+ <literal>8</literal>,而 <literal>"08"</literal> 将被解释为
<literal>"08"</literal>)。<varname>key</varname>
+ 中的浮点数被取整为 <type>integer</type>。在 PHP
+ 中索引数组与关联 <type>数组</type> 是相同的,它们都可以同时包含
<type>整型</type> 和 <type>字符串</type> 的下标。
+ </para>
+
+ <para>
+ 值可以是任意的 PHP 类型。
+ </para>
+
+ <informalexample>
+ <programlisting role="php">
+<![CDATA[
+<?php
+$arr = array("somearray" => array(6 => 5, 13 => 9, "a" => 42));
+
+echo $arr["somearray"][6]; // 5
+echo $arr["somearray"][13]; // 9
+echo $arr["somearray"]["a"]; // 42
+?>
+]]>
+ </programlisting>
+ </informalexample>
+
+ <para>
+ 如果对给出的值没有指定键名,则取当前最大的整数索引值,而新的键名将是该
值加一。如果指定的键名已经有了值,则该值会被覆盖。
+ </para>
+
+ <informalexample>
+ <programlisting role="php">
+<![CDATA[
+<?php
+// 这个数组与下面的数组相同 ...
+array(5 => 43, 32, 56, "b" => 12);
+
+// ...
+array(5 => 43, 6 => 32, 7 => 56, "b" => 12);
+?>
+]]>
+ </programlisting>
+ </informalexample>
+
+ <warning>
+ <simpara>
+ 自 PHP 4.3.0 起,上述的索引生成方法改变了。如今如果给一个当前最大键名
是负值的数组添加一个新值,则新生成的的索引将为零(<literal>0</literal>)。以
前新生成的索引为当前最大索引加一,和正值的索引相同。
+ </simpara>
+ </warning>
+
+ <para>
+ 使用 &true; 作为键名将使 <type>integer</type> <literal>1</literal> 成
为键名。使用
+ &false; 作为键名将使 <type>integer</type> <literal>0</literal> 成为键
名。使用
+ <literal>NULL</literal> 作为键名将等同于使用空字符串。使用空字符串作为
键名将新建(或覆盖)一个用空字符串作为键名的值,这和用空的方括号不一样。
+ </para>
+
+ <para>
+ 不能用数组和对象作为键(key)。这样做会导致一个警告:<literal>Illegal
offset type</literal>。
+ </para>
+
+ </sect3>
+
+ <sect3 xml:id="language.types.array.syntax.modifying">
+ <title>用方括号的语法新建/修改</title>
+
+ <para>
+ 可以通过明示地设定值来改变一个现有的数组。
+ </para>
+
+ <para>
+ 这是通过在方括号内指定键名来给数组赋值实现的。也可以省略键名,在这种情
况下给变量名加上一对空的方括号("<literal>[]</literal>")。
+ </para>
+
+ <synopsis>
+$arr[<replaceable>key</replaceable>] = <replaceable>value</replaceable>;
+$arr[] = <replaceable>value</replaceable>;
+// <replaceable>key</replaceable> 可以是 <type>integer</type> 或
<type>string</type>
+// <replaceable>value</replaceable> 可以是任意类型的值</synopsis>
+
+ <para>
+ 如果 <varname>$arr</varname> 还不存在,将会新建一个。这也是一种定义数
组的替换方法。要改变一个值,只要给它赋一个新值。如果要删除一个键名/值对,要
对它用 <function>unset</function>。
+ </para>
+
+ <informalexample>
+ <programlisting role="php">
+<![CDATA[
+<?php
+$arr = array(5 => 1, 12 => 2);
+
+$arr[] = 56; // This is the same as $arr[13] = 56;
+ // at this point of the script
+
+$arr["x"] = 42; // This adds a new element to
+ // the array with key "x"
+
+unset($arr[5]); // This removes the element from the array
+
+unset($arr); // This deletes the whole array
+?>
+]]>
+ </programlisting>
+ </informalexample>
+
+ <note>
+ <para>
+ 如上所述,如果给出方括号但没有指定键名,则取当前最大整数索引值,新的
键名将是该值
+ + 1。如果当前还没有整数索引,则键名将为
+ <literal>0</literal>。如果指定的键名已经有值了,该值将被覆盖。
+ </para>
+
+ <para>
+ 注意这里所使用的最大整数键名<emphasis>不一定</emphasis>当前就在数组
中。它只要在上次数组重新生成索引后曾经存在过就行了。以下面的例子来说明:
+ </para>
+
+ <informalexample>
+ <programlisting role="php">
+<![CDATA[
+<?php
+// 创建一个简单的数组
+$array = array(1, 2, 3, 4, 5);
+print_r($array);
+
+// 现在删除其中的所有元素,但保持数组本身不变:
+foreach ($array as $i => $value) {
+ unset($array[$i]);
+}
+print_r($array);
+
+// 添加一个单元(注意新的键名是 5,而不是你可能以为的 0)
+$array[] = 6;
+print_r($array);
+
+// 重新索引:
+$array = array_values($array);
+$array[] = 7;
+print_r($array);
+?>
+]]>
+ </programlisting>
+ &example.outputs;
+ <screen>
+<![CDATA[
+Array
+(
+ [0] => 1
+ [1] => 2
+ [2] => 3
+ [3] => 4
+ [4] => 5
+)
+Array
+(
+)
+Array
+(
+ [5] => 6
+)
+Array
+(
+ [0] => 6
+ [1] => 7
+)
+]]>
+ </screen>
+ </informalexample>
+
+ </note>
+
+ </sect3>
+ </sect2><!-- end syntax -->
+
+ <sect2 xml:id="language.types.array.useful-funcs">
+ <title>实用函数</title>
+
+ <para>
+ 有很多操作数组的函数,参见<link linkend="ref.array">数组函数</link>一
节。
+ </para>
+
+ <note>
+ <para>
+ <function>unset</function> 函数允许删除数组中的某个键。但要注意数组将不
会重建索引。
+ If a true "remove and shift" behavior is desired, the
+ <type>array</type> can be reindexed using the
+ <function>array_values</function> function.
+ </para>
+
+ <informalexample>
+ <programlisting role="php">
+<![CDATA[
+<?php
+$a = array(1 => 'one', 2 => 'two', 3 => 'three');
+unset($a[2]);
+/* will produce an array that would have been defined as
+ $a = array(1 => 'one', 3 => 'three');
+ and NOT
+ $a = array(1 => 'one', 2 =>'three');
+*/
+
+$b = array_values($a);
+// Now $b is array(0 => 'one', 1 =>'three')
+?>
+]]>
+ </programlisting>
+ </informalexample>
+ </note>
+
+ <para>
+ &foreach; 控制结构是专门用于数组的。它提供了一个简单的方法来遍历数组。
+ </para>
+ </sect2>
+
+ <sect2 xml:id="language.types.array.donts">
+ <title>数组做什么和不做什么</title>
+
+ <sect3 xml:id="language.types.array.foo-bar">
+ <title>为什么 <literal>$foo[bar]</literal> 错了?</title>
+
+ <para>
+ 应该始终在用字符串表示的数组索引上加上引号。例如用
+ $foo['bar'] 而不是 $foo[bar]。但是为什么 $foo[bar] 错了呢?可能在老的
脚本中见过如下语法:
+ </para>
+
+ <informalexample>
+ <programlisting role="php">
+<![CDATA[
+<?php
+$foo[bar] = 'enemy';
+echo $foo[bar];
+// etc
+?>
+]]>
+ </programlisting>
+ </informalexample>
+
+ <para>
+ 这样是错的,但可以正常运行。那么为什么错了呢?原因是此代码中有一个未定
义的常量(bar)而不是字符串('bar'-注意引号),而 PHP 可能会在以后定义此常
量,不幸的是你的代码中有同样的名字。它能运行,是因为
+ PHP 自动将<emphasis>裸字符串</emphasis>(没有引号的字符串且不对应于任
何已知符号)转换成一个其值为该裸字符串的正常字符串。例如,如果没有常量定义为
+ <constant>bar</constant>,PHP 将把它替代为 <literal>'bar'</literal> 并
使用之。
+ </para>
+
+ <note>
+ <simpara>
+ 这并不意味着<emphasis>总是</emphasis>给键名加上引号。用不着给键名为
<link
+ linkend="language.constants">常量</link>或<link
+ linkend="language.variables">变量</link>的加上引号,否则会使 PHP
+ 不能解析它们。
+ </simpara>
+
+ <informalexample>
+ <programlisting role="php">
+<![CDATA[
+<?php
+error_reporting(E_ALL);
+ini_set('display_errors', true);
+ini_set('html_errors', false);
+// Simple array:
+$array = array(1, 2);
+$count = count($array);
+for ($i = 0; $i < $count; $i++) {
+ echo "\nChecking $i: \n";
+ echo "Bad: " . $array['$i'] . "\n";
+ echo "Good: " . $array[$i] . "\n";
+ echo "Bad: {$array['$i']}\n";
+ echo "Good: {$array[$i]}\n";
+}
+?>
+]]>
+ </programlisting>
+ </informalexample>
+ &example.outputs;
+ <screen>
+<![CDATA[
+Checking 0:
+Notice: Undefined index: $i in /path/to/script.html on line 9
+Bad:
+Good: 1
+Notice: Undefined index: $i in /path/to/script.html on line 11
+Bad:
+Good: 1
+
+Checking 1:
+Notice: Undefined index: $i in /path/to/script.html on line 9
+Bad:
+Good: 2
+Notice: Undefined index: $i in /path/to/script.html on line 11
+Bad:
+Good: 2
+]]>
+ </screen>
+ </note>
+
+ <para>
+ 演示此行为的更多例子:
+ </para>
+
+ <informalexample>
+ <programlisting role="php">
+<![CDATA[
+<?php
+// Show all errors
+error_reporting(E_ALL);
+
+$arr = array('fruit' => 'apple', 'veggie' => 'carrot');
+
+// Correct
+print $arr['fruit']; // apple
+print $arr['veggie']; // carrot
+
+// Incorrect. This works but also throws a PHP error of level E_NOTICE
because
+// of an undefined constant named fruit
+//
+// Notice: Use of undefined constant fruit - assumed 'fruit' in...
+print $arr[fruit]; // apple
+
+// This defines a constant to demonstrate what's going on. The
value 'veggie'
+// is assigned to a constant named fruit.
+define('fruit', 'veggie');
+
+// Notice the difference now
+print $arr['fruit']; // apple
+print $arr[fruit]; // carrot
+
+// The following is okay, as it's inside a string. Constants are not
looked for
+// within strings, so no E_NOTICE occurs here
+print "Hello $arr[fruit]"; // Hello apple
+
+// With one exception: braces surrounding arrays within strings allows
constants
+// to be interpreted
+print "Hello {$arr[fruit]}"; // Hello carrot
+print "Hello {$arr['fruit']}"; // Hello apple
+
+// This will not work, and will result in a parse error, such as:
+// Parse error: parse error, expecting T_STRING' or T_VARIABLE' or
T_NUM_STRING'
+// This of course applies to using superglobals in strings as well
+print "Hello $arr['fruit']";
+print "Hello $_GET['foo']";
+
+// Concatenation is another option
+print "Hello " . $arr['fruit']; // Hello apple
+?>
+]]>
+ </programlisting>
+ </informalexample>
+
+ <para>
+ 当打开 <link linkend="ini.error-reporting">error_reporting</link> 来显

+ <constant>E_NOTICE</constant> 级别的错误(例如将其设为
+ <constant>E_ALL</constant>)时将看到这些错误。默认情况下
+ <link linkend="ini.error-reporting">error_reporting</link>
+ 被关闭不显示这些。
+ </para>
+
+ <para>
+ 和在<link linkend="language.types.array.syntax">语法</link>一节中规定
的一样,在方括号("<literal>[</literal>"和"<literal>]</literal>")之间必须有
一个表达式。这意味着可以这样写:
+ </para>
+
+ <informalexample>
+ <programlisting role="php">
+<![CDATA[
+<?php
+echo $arr[somefunc($bar)];
+?>
+]]>
+ </programlisting>
+ </informalexample>
+
+ <para>
+ 这是一个用函数返回值作为数组索引的例子。PHP 也可以用已知常量,可能之前
已经见过
+ </para>
+
+ <informalexample>
+ <programlisting role="php">
+<![CDATA[
+<?php
+$error_descriptions[E_ERROR] = "A fatal error has occured";
+$error_descriptions[E_WARNING] = "PHP issued a warning";
+$error_descriptions[E_NOTICE] = "This is just an informal notice";
+?>
+]]>
+ </programlisting>
+ </informalexample>
+
+ <para>
+ 注意 <literal>E_ERROR</literal> 也是个合法的标识符,就和第一个例子中的
+ <literal>bar</literal> 一样。但是上一个例子实际上和如下写法是一样的:
+ </para>
+
+ <informalexample>
+ <programlisting role="php">
+<![CDATA[
+<?php
+$error_descriptions[1] = "A fatal error has occured";
+$error_descriptions[2] = "PHP issued a warning";
+$error_descriptions[8] = "This is just an informal notice";
+?>
+]]>
+ </programlisting>
+ </informalexample>
+
+ <para>
+ 因为 <literal>E_ERROR</literal> 等于 <literal>1</literal>, 等等.
+ </para>
+
+ <sect4 xml:id="language.types.array.foo-bar.why">
+ <title>那么为什么这样做不好?</title>
+
+ <para>
+ 也许有一天,PHP 开发小组可能会想新增一个常量或者关键字,或者用户可能
希望以后在自己的程序中引入新的常量,那就有麻烦了。例如已经不能这样用
+ <literal>empty</literal> 和 <literal>default</literal> 这两个词了,因
为他们是<link linkend="reserved">保留字</link>。
+ </para>
+
+ <note>
+ <simpara>
+ 重申一次,在双引号字符串中,不给索引加上引号是合法的因此
+ <literal>"$foo[bar]"</literal>是合法的("合法"的原文为valid。在实际
测试中,这么做确实可以访问数组的该元素,但是会报一个常量未定义的notice。无论
如何,强烈建议不要使用$foo[bar]这样的写法,而要使用$foo['bar']来访问数组中元
素。--haohappy注)。至于为什么参见以上的例子和<link
+ linkend="language.types.string.parsing">字符串中的变量解析</link>中
的解释。
+ </simpara>
+ </note>
+
+ </sect4>
+ </sect3>
+ </sect2>
+
+ <sect2 xml:id="language.types.array.casting">
+ <title>转换为数组</title>
+
+ <para>
+ 对于任意类型: <type>integer</type>, <type>float</type>,
+ <type>string</type>, <type>boolean</type> and <type>resource</type>,如果
将一个值转换为数组,将得到一个仅有一个元素的数组(其下标为 0),该元素即为此
标量的值。换句话说,
+ <literal>(array)$scalarValue</literal> 与
<literal>array($scalarValue)</literal> 完全一样。
+ </para>
+
+ <para>
+ If an <type>object</type> is converted to an <type>array</type>, the
result
+ is an <type>array</type> whose elements are the <type>object</type>'s
+ properties. The keys are the member variable names, with a few notable
+ exceptions: integer properties are unaccessible;
+ private variables have the class name prepended to the variable
+ name; protected variables have a '*' prepended to the variable name.
These
+ prepended values have null bytes on either side. This can result in some
+ unexpected behaviour:
+ </para>
+
+ <informalexample>
+ <programlisting role="php">
+<![CDATA[
+<?php
+
+class A {
+ private $A; // This will become '\0A\0A'
+}
+
+class B extends A {
+ private $A; // This will become '\0B\0A'
+ public $AA; // This will become 'AA'
+}
+
+var_dump((array) new B());
+?>
+]]>
+ </programlisting>
+ </informalexample>
+
+ <para>
+ The above will appear to have two keys named 'AA', although one of them
is
+ actually named '\0A\0A'.
+ </para>
+
+ <para>
+ 将 &null; 转换到 <type>数组(array)</type> 会得到一个空的数组。
+ </para>
+ </sect2>
+
+ <sect2 xml:id="language.types.array.comparing">
+ <title>比较</title>
+
+ <para>
+ 可能使用 <function>array_diff</function> 和<link
+ linkend="language.operators.array">数组运算符</link>来比较数组。
+ </para>
+ </sect2>
+
+ <sect2 xml:id="language.types.array.examples">
+ <title>Examples</title>
+
+ <para>
+ PHP 中的数组类型有非常多的用途,因此这里有一些例子展示数组的完整威力。
+ </para>
+
+ <informalexample>
+ <programlisting role="php">
+<![CDATA[
+<?php
+// This:
+$a = array( 'color' => 'red',
+ 'taste' => 'sweet',
+ 'shape' => 'round',
+ 'name' => 'apple',
+ 4 // key will be 0
+ );
+
+$b = array('a', 'b', 'c');
+
+// . . .is completely equivalent with this:
+$a = array();
+$a['color'] = 'red';
+$a['taste'] = 'sweet';
+$a['shape'] = 'round';
+$a['name'] = 'apple';
+$a[] = 4; // key will be 0
+
+$b = array();
+$b[] = 'a';
+$b[] = 'b';
+$b[] = 'c';
+
+// After the above code is executed, $a will be the array
+// array('color' => 'red', 'taste' => 'sweet', 'shape' => 'round',
+// 'name' => 'apple', 0 => 4), and $b will be the array
+// array(0 => 'a', 1 => 'b', 2 => 'c'), or simply array('a', 'b', 'c').
+?>
+]]>
+ </programlisting>
+ </informalexample>
+
+ <example>
+ <title>Using array()</title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+// Array as (property-)map
+$map = array( 'version' => 4,
+ 'OS' => 'Linux',
+ 'lang' => 'english',
+ 'short_tags' => true
+ );
+
+// strictly numerical keys
+$array = array( 7,
+ 8,
+ 0,
+ 156,
+ -10
+ );
+// this is the same as array(0 => 7, 1 => 8, ...)
+
+$switching = array( 10, // key = 0
+ 5 => 6,
+ 3 => 7,
+ 'a' => 4,
+ 11, // key = 6 (maximum of integer-indices was
5)
+ '8' => 2, // key = 8 (integer!)
+ '02' => 77, // key = '02'
+ 0 => 12 // the value 10 will be overwritten by 12
+ );
+
+// empty array
+$empty = array();
+?>
+]]>
+<!-- TODO example of
+- overwriting keys
+- using vars/functions as key/values
+- warning about references
+-->
+ </programlisting>
+ </example>
+
+ <example xml:id="language.types.array.examples.loop">
+ <title>集合</title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+$colors = array('red', 'blue', 'green', 'yellow');
+
+foreach ($colors as $color) {
+ echo "Do you like $color?\n";
+}
+
+?>
+]]>
+ </programlisting>
+ &example.outputs;
+ <screen>
+<![CDATA[
+Do you like red?
+Do you like blue?
+Do you like green?
+Do you like yellow?
+]]>
+ </screen>
+ </example>
+
+ <para>
+ 直接改变数组的值在 PHP 5 中可以通过引用传递来做到。之前的版本需要需要采
取变通的方法:
+ </para>
+
+ <example xml:id="language.types.array.examples.changeloop">
+ <title>集合</title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+// PHP 5
+foreach ($colors as &$color) {
+ $color = strtoupper($color);
+}
+unset($color); /* ensure that following writes to
+$color will not modify the last array element */
+
+// Workaround for older versions
+foreach ($colors as $key => $color) {
+ $colors[$key] = strtoupper($color);
+}
+
+print_r($colors);
+?>
+]]>
+ </programlisting>
+ &example.outputs;
+ <screen>
+<![CDATA[
+Array
+(
+ [0] => RED
+ [1] => BLUE
+ [2] => GREEN
+ [3] => YELLOW
+)
+]]>
+ </screen>
+ </example>
+
+ <para>
+ 本例生成一个下标从1开始的数组。This example creates a one-based array.
+ </para>
+
+ <example>
+ <title>下标从1开始的数组</title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+$firstquarter = array(1 => 'January', 'February', 'March');
+print_r($firstquarter);
+?>
+]]>
+ </programlisting>
+ &example.outputs;
+ <screen>
+<![CDATA[
+Array
+(
+ [1] => 'January'
+ [2] => 'February'
+ [3] => 'March'
+)
+]]>
+ </screen>
+ </example>
+
+ <example>
+ <title>填充数组</title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+// fill an array with all items from a directory
+$handle = opendir('.');
+while (false !== ($file = readdir($handle))) {
+ $files[] = $file;
+}
+closedir($handle);
+?>
+]]>
+ </programlisting>
+ </example>
+
+ <para>
+ 数组是有序的。也可以使用不同的排序函数来改变顺序。更多信息参见<link
+ linkend="ref.array">数组函数</link>。可以用
+ <function>count</function> 函数来数出数组中元素的个数。
+ </para>
+
+ <example>
+ <title>数组排序</title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+sort($files);
+print_r($files);
+?>
+]]>
+ </programlisting>
+ </example>
+
+ <para>
+ 因为数组中的值可以为任意值,也可是另一个数组。这样可以产生递归或多维数
组。
+ </para>
+
+ <example>
+ <title>递归和多维数组</title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+$fruits = array ( "fruits" => array ( "a" => "orange",
+ "b" => "banana",
+ "c" => "apple"
+ ),
+ "numbers" => array ( 1,
+ 2,
+ 3,
+ 4,
+ 5,
+ 6
+ ),
+ "holes" => array ( "first",
+ 5 => "second",
+ "third"
+ )
+ );
+
+// Some examples to address values in the array above
+echo $fruits["holes"][5]; // prints "second"
+echo $fruits["fruits"]["a"]; // prints "orange"
+unset($fruits["holes"][0]); // remove "first"
+
+// Create a new multi-dimensional array
+$juices["apple"]["green"] = "good";
+?>
+]]>
+ </programlisting>
+ </example>
+
+ <para>
+ <type>数组(Array)</type> 的赋值总是会涉及到值的拷贝。使用 <link
+ linkend="language.operators">引用操作符</link> 通过引用来拷贝数组。
+ </para>
+
+ <informalexample>
+ <programlisting role="php">
+<![CDATA[
+<?php
+$arr1 = array(2, 3);
+$arr2 = $arr1;
+$arr2[] = 4; // $arr2 is changed,
+ // $arr1 is still array(2, 3)
+
+$arr3 = &$arr1;
+$arr3[] = 4; // now $arr1 and $arr3 are the same
+?>
+]]>
+ </programlisting>
+ </informalexample>
+
+ </sect2>
+</sect1>
+
+<!-- Keep this comment at the end of the file
+Local variables:
+mode: sgml
+sgml-omittag:t
+sgml-shorttag:t
+sgml-minimize-attributes:nil
+sgml-always-quote-attributes:t
+sgml-indent-step:1
+sgml-indent-data:t
+indent-tabs-mode:nil
+sgml-parent-document:nil
+sgml-default-dtd-file:"~/.phpdoc/manual.ced"
+sgml-exposed-tags:nil
+sgml-local-catalogs:nil
+sgml-local-ecat-files:nil
+End:
+vim600: syn=xml fen fdm=syntax fdl=2 si
+vim: et tw=78 syn=sgml
+vi: ts=1 sw=1
+-->
=======================================
--- /dev/null
+++ /trunk/xml/language/types.xml Mon Apr 9 09:11:24 2012
@@ -0,0 +1,214 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- $Revision: 324974 $ -->
+<!-- EN-Revision: 324122 Maintainer: HonestQiao Status: ready -->
+<!-- Reviewed: no Maintainer: HonestQiao -->
+<!-- CREDITS: dallas, Gregory, Haohappy -->
+<chapter xml:id="language.types" xmlns="http://docbook.org/ns/docbook">
+ <title>类型</title>
+
+ <sect1 xml:id="language.types.intro">
+ <title>简介</title>
+
+ <simpara>
+ PHP 支持8种基本的数据类型。
+ </simpara>
+
+ <para>
+ 四种标量类型:
+ </para>
+
+ <itemizedlist>
+
+ <listitem>
+ <simpara>
+ <type>boolean</type> (布尔型)
+ </simpara>
+ </listitem>
+
+ <listitem>
+ <simpara>
+ <type>integer</type> (整型)
+ </simpara>
+ </listitem>
+
+ <listitem>
+ <simpara>
+ <type>float</type> (浮点型, 也称作 <type>double</type>)
+ </simpara>
+ </listitem>
+
+ <listitem>
+ <simpara>
+ <type>string</type> (字符串)
+ </simpara>
+ </listitem>
+
+ </itemizedlist>
+
+ <para>
+ 两种复合类型:
+ </para>
+
+ <itemizedlist>
+
+ <listitem>
+ <simpara>
+ <type>array</type> (数组)
+ </simpara>
+ </listitem>
+
+ <listitem>
+ <simpara>
+ <type>object</type> (对象)
+ </simpara>
+ </listitem>
+
+ </itemizedlist>
+
+ <para>
+ 最后是两种特殊类型:
+ </para>
+
+ <itemizedlist>
+
+ <listitem>
+ <simpara>
+ <type>resource</type> (资源)
+ </simpara>
+ </listitem>
+
+ <listitem>
+ <simpara>
+ <type>NULL</type> (NULL)
+ </simpara>
+ </listitem>
+
+ </itemizedlist>
+
+ <para>
+ 为了确保代码的易读性,本手册还介绍了一些<link
+ linkend="language.pseudo-types">伪类型</link>:
+ </para>
+
+ <itemizedlist>
+
+ <listitem>
+ <simpara>
+ <type>mixed</type>
+ </simpara>
+ </listitem>
+
+ <listitem>
+ <simpara>
+ <type>number</type>
+ </simpara>
+ </listitem>
+
+ <listitem>
+ <simpara>
+ <type>callback</type>
+ </simpara>
+ </listitem>
+
+ </itemizedlist>
+
+ <para>
+ 以及伪变量 <parameter>$...</parameter>.
+ </para>
+
+ <simpara>
+ 可能还会读到一些关于"双精度(double)"类型的参考。实际上
+ double 和 float 是相同的,由于一些历史的原因,这两个名称同时存在。
+ </simpara>
+
+ <simpara>
+ 变量的类型通常不是由程序员设定的,确切地说,是由 PHP
+ 根据该变量使用的上下文在运行时决定的。
+ </simpara>
+
+ <note>
+ <simpara>
+ 如果想查看某个<link linkend="language.expressions">表达式</link>的值和
类型,用
+ <function>var_dump</function>。
+ </simpara>
+
+ <para>
+ 如果只是想得到一个易读懂的类型的表达方式用于调试,用
+ <function>gettype</function>。要查看某个类型,<emphasis>不要
</emphasis>用
+ <function>gettype</function>,而用
<literal>is_<replaceable>type</replaceable></literal> 函数。以下是一些范例:
+ </para>
+
+ <informalexample>
+ <programlisting role="php">
+<![CDATA[
+<?php
+$a_bool = TRUE; // a boolean
+$a_str = "foo"; // a string
+$a_str2 = 'foo'; // a string
+$an_int = 12; // an integer
+
+echo gettype($a_bool); // prints out: boolean
+echo gettype($a_str); // prints out: string
+
+// If this is an integer, increment it by four
+if (is_int($an_int)) {
+ $an_int += 4;
+}
+
+// If $bool is a string, print it out
+// (does not print out anything)
+if (is_string($a_bool)) {
+ echo "String: $a_bool";
+}
+?>
+]]>
+ </programlisting>
+ </informalexample>
+ </note>
+
+ <simpara>
+ 如果要将一个变量强制转换为某类型,可以对其使用<link
+ linkend="language.types.typecasting">强制转换</link>或者
<function>settype</function> 函数。
+ </simpara>
+
+ <simpara>
+ 注意变量根据其当时的类型在特定场合下会表现出不同的值。更多信息见<link
+ linkend="language.types.type-juggling">类型戏法</link>。此外,你还可以参

+ <link linkend="types.comparisons">PHP 类型比较表</link>看不同类型相互比
较的例子。
+ </simpara>
+ </sect1>
+
+ &language.types.boolean;
+ &language.types.integer;
+ &language.types.float;
+ &language.types.string;
+ &language.types.array;
+ &language.types.object;
+ &language.types.resource;
+ &language.types.null;
+ &language.types.callable;
+ &language.types.pseudo-types;
+ &language.types.type-juggling;
+
+</chapter>
+
+<!-- Keep this comment at the end of the file
+Local variables:
+mode: sgml
+sgml-omittag:t
+sgml-shorttag:t
+sgml-minimize-attributes:nil
+sgml-always-quote-attributes:t
+sgml-indent-step:1
+sgml-indent-data:t
+indent-tabs-mode:nil
+sgml-parent-document:nil
+sgml-default-dtd-file:"~/.phpdoc/manual.ced"
+sgml-exposed-tags:nil
+sgml-local-catalogs:nil
+sgml-local-ecat-files:nil
+End:
+vim600: syn=xml fen fdm=syntax fdl=2 si
+vim: et tw=78 syn=sgml
+vi: ts=1 sw=1
+-->
=======================================
--- /dev/null
+++ /trunk/xml/language/variables.xml Mon Apr 9 09:11:24 2012
@@ -0,0 +1,948 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- $Revision: 324974 $ -->
+<!-- EN-Revision: 324522 Maintainer: HonestQiao Status: ready -->
+<!-- Reviewed: no Maintainer: HonestQiao -->
+<!-- CREDITS: dallas, Gregory, verdana -->
+ <chapter xml:id="language.variables"
xmlns="http://docbook.org/ns/docbook"
xmlns:xlink="http://www.w3.org/1999/xlink">
+ <title>变量</title>
+
+ <sect1 xml:id="language.variables.basics">
+ <title>基础</title>
+
+ <simpara>
+ PHP 中的变量用一个美元符号后面跟变量名来表示。变量名是区分大小写的。
+ </simpara>
+
+ <para>
+ 变量名与 PHP
+ 中其它的标签一样遵循相同的规则。一个有效的变量名由字母或者下划线开
头,后面跟上任意数量的字母,数字,或者下划线。按照正常的正则表达式,它将被表
述为:'[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*'。
+ </para>
+
+ <note>
+ <simpara>
+ 在此所说的字母是 a-z,A-Z,以及 ASCII 字符从 127 到 255(0x7f-0xff)。
+ </simpara>
+ </note>
+ <note>
+ <simpara>
+ <literal>$this</literal> 是一个特殊的变量,它不能被赋值。
+ </simpara>
+ </note>
+
+ &tip.userlandnaming;
+
+ <para>
+ 有关变量的函数信息见<link linkend="ref.var">变量函数</link>。
+ </para>
+ <para>
+ <informalexample>
+ <programlisting role="php">
+<![CDATA[
+<?php
+$var = 'Bob';
+$Var = 'Joe';
+echo "$var, $Var"; // 输出 "Bob, Joe"
+
+$4site = 'not yet'; // 非法变量名;以数字开头
+$_4site = 'not yet'; // 合法变量名;以下划线开头
+$i站点is = 'mansikka'; // 合法变量名;可以用中文
+?>
+]]>
+ </programlisting>
+ </informalexample>
+ </para>
+
+ <para>
+ 变量默认总是传值赋值。那也就是说,当将一个表达式的值赋予一个变量时,整
个原始表达式的值被赋值到目标变量。这意味着,例如,当一个变量的值赋予另外一个
变量时,改变其中一个变量的值,将不会影响到另外一个变量。有关这种类型的赋值操
作,请参阅<link linkend="language.expressions">表达式</link>一章。
+ </para>
+ <para>
+ PHP 也提供了另外一种方式给变量赋值:<link
linkend="language.references">引用赋值</link>。这意味着新的变量简单的引用
(换言之,"成为其别名" 或者 "指向")了原始变量。改动新的变量将影响到原始变
量,反之亦然。
+ </para>
+ <para>
+ 使用引用赋值,简单地将一个 &amp;
+ 符号加到将要赋值的变量前(源变量)。例如,下列代码片断将输出"My name
is Bob"两次:
+ <informalexample>
+ <programlisting role="php">
+<![CDATA[
+<?php
+$foo = 'Bob'; // 将 'Bob' 赋给 $foo
+$bar = &$foo; // 通过 $bar 引用 $foo
+$bar = "My name is $bar"; // 修改 $bar 变量
+echo $bar;
+echo $foo; // $foo 的值也被修改
+?>
+]]>
+ </programlisting>
+ </informalexample>
+ </para>
+
+ <para>
+ 有一点重要事项必须指出,那就是只有有名字的变量才可以引用赋值。
+ <informalexample>
+ <programlisting role="php">
+<![CDATA[
+<?php
+$foo = 25;
+$bar = &$foo; // 合法的赋值
+$bar = &(24 * 7); // 非法; 引用没有名字的表达式
+
+function test()
+{
+ return 25;
+}
+
+$bar = &test(); // 非法
+?>
+]]>
+ </programlisting>
+ </informalexample>
+ </para>
+ <para>
+ 虽然在 PHP 中并不需要初始化变量,但对变量进行初始化是个好习惯。未初始化
的变量具有其类型的默认值 - 布尔类型的变量默认值是
+ &false;,整形和浮点型变量默认值是零,字符串型变量默认值是空字符串或者数
组变量的默认值是空数组。
+ </para>
+ <para>
+ <example>
+ <title>未初始化变量的默认值</title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+// Unset AND unreferenced (no use context) variable; outputs NULL
+var_dump($unset_var);
+
+// Boolean usage; outputs 'false' (See ternary operators for more on this
syntax)
+echo($unset_bool ? "true\n" : "false\n");
+
+// String usage; outputs 'string(3) "abc"'
+$unset_str .= 'abc';
+var_dump($unset_str);
+
+// Integer usage; outputs 'int(25)'
+$unset_int += 25; // 0 + 25 => 25
+var_dump($unset_int);
+
+// Float/double usage; outputs 'float(1.25)'
+$unset_float += 1.25;
+var_dump($unset_float);
+
+// Array usage; outputs array(1) { [3]=> string(3) "def" }
+$unset_arr[3] = "def"; // array() + array(3 => "def") => array(3 => "def")
+var_dump($unset_arr);
+
+// Object usage; creates new stdClass object (see
http://www.php.net/manual/en/reserved.classes.php)
+// Outputs: object(stdClass)#1 (1) { ["foo"]=> string(3) "bar" }
+$unset_obj->foo = 'bar';
+var_dump($unset_obj);
+?>
+]]>
+ </programlisting>
+ </example>
+ </para>
+ <para>
+ 依赖未初始化变量的默认值在某些情况下会有问题,例如把一个文件包含到另一
个之中时碰上相同的变量名。另外把
+ <link linkend="ini.register-globals">register_globals</link> 打开是一个
主要的<link
+ linkend="security.globals">安全隐患</link>。使用未初始化的变量会发出
<link
+ linkend="errorfunc.constants.errorlevels.e-notice">E_NOTICE</link>错
误,但是在向一个未初始化的数组附加单元时不会。<function>isset</function>
+ 语言结构可以用来检测一个变量是否已被初始化。
+ </para>
+ </sect1>
+
+ <sect1 xml:id="language.variables.predefined">
+ <title>预定义变量</title>
+
+ <simpara>
+ PHP 提供了大量的预定义变量。由于许多变量依赖于运行的服务器的版本和设
置,及其它因素,所以并没有详细的说明文档。一些预定义变量在
+ PHP 以<link linkend="features.commandline">命令行</link>形式运行时并不
生效。有关这些变量的详细列表,请参阅<link
+ linkend="reserved.variables">预定义变量</link>一章。
+ </simpara>
+
+ <warning>
+ <simpara>
+ PHP 4.2.0 以及后续版本中,PHP 指令 <link
+ linkend="ini.register-globals">register_globals</link> 的默认值为
+ <emphasis>off</emphasis>。这是 PHP 的一个主要变化。让
register_globals 的值为
+ <emphasis>off</emphasis> 将影响到预定义变量集在全局范围内的有效性。例
如,为了得到
+ <varname>DOCUMENT_ROOT</varname> 的值,将必须使用
+ <varname>$_SERVER['DOCUMENT_ROOT']</varname> 代替
+ <varname>$DOCUMENT_ROOT</varname>,又如,使用
+ <varname>$_GET['id']</varname> 来代替 <varname>$id</varname> 从 URL
+ <literal>http://www.example.com/test.php?id=3</literal> 中获取
+ id 值,亦或使用 <varname>$_ENV['HOME']</varname> 来代替
+ <varname>$HOME</varname> 获取环境变量 HOME 的值。
+ </simpara>
+ <simpara>
+ 更多相关信息,请阅读 <link
+ linkend="ini.register-globals">register_globals</link>
+ 的配置项条目,安全一章中的<link
+ linkend="security.globals">使用 Register Globals</link>,以及 PHP
+ <link xlink:href="&url.php.release4.1.0;">4.1.0</link> 和
+ <link xlink:href="&url.php.release4.2.0;">4.2.0</link> 的发布公告。
+ </simpara>
+ <simpara>
+ 如果有可用的 PHP 预定义变量那最好用,如<link
+ linkend="language.variables.superglobals">超全局数组</link>。
+ </simpara>
+ </warning>
+
+ <simpara>
+ 从 PHP 4.1.0 开始,PHP 提供了一套附加的预定数组,这些数组变量包含了来
自 web
+ 服务器(如果可用),运行环境,和用户输入的数据。这些数组非常特别,它们
在全局范围内自动生效,例如,在任何范围内自动生效。因此通常被称为自动全局变量
(autoglobals)或者超全局变量(superglobals)。(PHP
+ 中没有用户自定义超全局变量的机制。)超全局变量罗列于下文中;但是为了得
到它们的内容和关于
+ PHP 预定义变量的进一步的讨论以及它们的本质,请参阅<link
+ linkend="reserved.variables">预定义变量</link>。而且,你也将注意到旧的
预定义数组(<varname>$HTTP_*_VARS</varname>)仍旧存在。
&avail.register-long-arrays;
+ </simpara>
+
+ <note>
+ <title>可变变量</title>
+ <para>
+ 超级全局变量不能被用作<link linkend="language.variables.variable">可变
变量</link>。
+ </para>
+ </note>
+ <note>
+ <para>
+ 尽管超全局变量和 HTTP_*_VARS
+ 同时存在。但是他们并不是同一个变量,所以改变一个的值并不会对另一个产生
影响。
+ </para>
+ </note>
+
+ <para>
+ 如果某些 <link linkend="ini.variables-order">variables_order</link>
+ 中的变量没有设定,它们的对应的 PHP 预定义数组也是空的。
+ </para>
+
+ </sect1>
+
+
+ <sect1 xml:id="language.variables.scope">
+ <title>变量范围</title>
+
+ <simpara>
+ 变量的范围即它定义的上下文背景(也就是它的生效范围)。大部分的
+ PHP 变量只有一个单独的范围。这个单独的范围跨度同样包含了
+ include 和 require 引入的文件。例如:
+ </simpara>
+ <informalexample>
+ <programlisting role="php">
+<![CDATA[
+<?php
+$a = 1;
+include 'b.inc';
+?>
+]]>
+ </programlisting>
+ </informalexample>
+ <simpara>
+ 这里变量 <varname>$a</varname> 将会在包含文件
+ <filename>b.inc</filename> 中生效。但是,在用户自定义函数中,一个局部函
数范围将被引入。任何用于函数内部的变量按缺省情况将被限制在局部函数范围内。例
如:
+ </simpara>
+
+ <informalexample>
+ <programlisting role="php">
+<![CDATA[
+<?php
+$a = 1; /* global scope */
+
+function Test()
+{
+ echo $a; /* reference to local scope variable */
+}
+
+Test();
+?>
+]]>
+ </programlisting>
+ </informalexample>
+
+ <simpara>
+ 这个脚本不会有任何输出,因为 echo 语句引用了一个局部版本的变量
+ <varname>$a</varname>,而且在这个范围内,它并没有被赋值。你可能注意到
+ PHP 的全局变量和 C 语言有一点点不同,在 C
+ 语言中,全局变量在函数中自动生效,除非被局部变量覆盖。这可能引起一些问
题,有些人可能不小心就改变了一个全局变量。PHP
+ 中全局变量在函数中使用时必须申明为global。
+ </simpara>
+
+ <sect2 xml:id="language.variables.scope.global">
+ <title>global 关键字</title>
+ <simpara>
+ 首先,一个使用 <literal>global</literal> 的例子:
+ </simpara>
+ <para>
+ <example>
+ <title>使用 global</title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+$a = 1;
+$b = 2;
+
+function Sum()
+{
+ global $a, $b;
+
+ $b = $a + $b;
+}
+
+Sum();
+echo $b;
+?>
+]]>
+ </programlisting>
+ </example>
+ </para>
+
+ <simpara>
+ 以上脚本的输出将是"3"。在函数中申明了全局变量
+ <varname>$a</varname> 和 <varname>$b</varname>,任何变量的所有引用变量
都会指向到全局变量。对于一个函数能够申明的全局变量的最大个数,PHP 没有限制。
+ </simpara>
+
+ <simpara>
+ 在全局范围内访问变量的第二个办法,是用特殊的 PHP 自定义
+ <varname>$GLOBALS</varname> 数组。前面的例子可以写成:
+ </simpara>
+
+ <para>
+ <example>
+ <title>使用 <varname>$GLOBALS</varname> 替代 global</title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+$a = 1;
+$b = 2;
+
+function Sum()
+{
+ $GLOBALS['b'] = $GLOBALS['a'] + $GLOBALS['b'];
+}
+
+Sum();
+echo $b;
+?>
+]]>
+ </programlisting>
+ </example>
+ </para>
+
+ <simpara>
+ <varname>$GLOBALS</varname>
+ 是一个关联数组,每一个变量为一个元素,键名对应变量名,值对应变量的内
容。<varname>$GLOBALS</varname>
+ 之所以在全局范围内存在,是因为 $GLOBALS 是一个<link
+ linkend="language.variables.superglobals">超全局变量</link>。以下范例
显示了超全局变量的用处:
+ </simpara>
+
+ <para>
+ <example>
+ <title>演示超全局变量和作用域的例子</title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+function test_global()
+{
+ // 大多数的预定义变量并不 "super",它们需要用 'global' 关键字来使它们在
函数的本地区域中有效。
+ global $HTTP_POST_VARS;
+
+ echo $HTTP_POST_VARS['name'];
+
+ // Superglobals 在任何范围内都有效,它们并不需要 'global' 声明。
Superglobals 是在 PHP 4.1.0 引入的。
+ echo $_POST['name'];
+}
+?>
+]]>
+ </programlisting>
+ </example>
+ </para>
+ </sect2>
+
+ <sect2 xml:id="language.variables.scope.static">
+ <title>使用静态变量</title>
+
+ <simpara>
+ 变量范围的另一个重要特性是<emphasis>静态变量</emphasis>(static
+ variable)。静态变量仅在局部函数域中存在,但当程序执行离开此作用域
时,其值并不丢失。看看下面的例子:
+ </simpara>
+
+ <para>
+ <example>
+ <title>演示需要静态变量的例子</title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+function Test()
+{
+ $a = 0;
+ echo $a;
+ $a++;
+}
+?>
+]]>
+ </programlisting>
+ </example>
+ </para>
+
+ <simpara>
+ 本函数没什么用处,因为每次调用时都会将
+ <varname>$a</varname> 的值设为 <literal>0</literal> 并输出
+ &quot;0&quot;。将变量加一的 <varname>$a</varname>++
+ 没有作用,因为一旦退出本函数则变量
+ <varname>$a</varname> 就不存在了。要写一个不会丢失本次计数值的计数函
数,要将变量
+ <varname>$a</varname> 定义为静态的:
+ </simpara>
+
+ <para>
+ <example>
+ <title>使用静态变量的例子</title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+function test()
+{
+ static $a = 0;
+ echo $a;
+ $a++;
+}
+?>
+]]>
+ </programlisting>
+ </example>
+ </para>
+
+ <simpara>
+ 现在,变量<varname>$a</varname>在第一调用test()时被初始化,每次调用
test() 函数都会输出
+ <varname>$a</varname> 的值并加一。
+ </simpara>
+
+ <simpara>
+ 静态变量也提供了一种处理递归函数的方法。递归函数是一种调用自己的函数。
写递归函数时要小心,因为可能会无穷递归下去。必须确保有充分的方法来中止递归。
一下这个简单的函数递归计数到
+ 10,使用静态变量
+ <varname>$count</varname> 来判断何时停止:
+ </simpara>
+
+ <para>
+ <example>
+ <title>静态变量与递归函数</title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+function test()
+{
+ static $count = 0;
+
+ $count++;
+ echo $count;
+ if ($count < 10) {
+ test();
+ }
+ $count--;
+}
+?>
+]]>
+ </programlisting>
+ </example>
+ </para>
+
+ <note>
+ <para>
+ 静态变量可以按照上面的例子声明。如果在声明中用表达式的结果对其赋值会
导致解析错误。
+ </para>
+ <para>
+ <example>
+ <title>声明静态变量</title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+function foo(){
+ static $int = 0; // correct
+ static $int = 1+2; // wrong (as it is an expression)
+ static $int = sqrt(121); // wrong (as it is an expression too)
+
+ $int++;
+ echo $int;
+}
+?>
+]]>
+ </programlisting>
+ </example>
+ </para>
+ </note>
+ </sect2>
+
+ <sect2 xml:id="language.variables.scope.references">
+ <title>全局和静态变量的引用</title>
+ <simpara>
+ 在 Zend 引擎 1 代,它驱动了 PHP4,对于变量的
+ <link linkend="language.variables.scope.static">static</link> 和
+ <link linkend="language.variables.scope.global">global</link>
+ 定义是以 <link linkend="language.references">references</link>
+ 的方式实现的。例如,在一个函数域内部用
+ <literal>global</literal>
+ 语句导入的一个真正的全局变量实际上是建立了一个到全局变量的引用。这有可
能导致预料之外的行为,如以下例子所演示的:
+ </simpara>
+
+ <informalexample>
+ <programlisting role="php">
+<![CDATA[
+<?php
+function test_global_ref() {
+ global $obj;
+ $obj = &new stdclass;
+}
+
+function test_global_noref() {
+ global $obj;
+ $obj = new stdclass;
+}
+
+test_global_ref();
+var_dump($obj);
+test_global_noref();
+var_dump($obj);
+?>
+]]>
+ </programlisting>
+ </informalexample>
+
+ &example.outputs;
+
+ <screen>
+NULL
+object(stdClass)(0) {
+}
+ </screen>
+
+ <simpara>
+ 类似的行为也适用于
+ <literal>static</literal> 语句。引用并不是静态地存储的:
+ </simpara>
+
+ <informalexample>
+ <programlisting role="php">
+<![CDATA[
+<?php
+function &get_instance_ref() {
+ static $obj;
+
+ echo 'Static object: ';
+ var_dump($obj);
+ if (!isset($obj)) {
+ // 将一个引用赋值给静态变量
+ $obj = &new stdclass;
+ }
+ $obj->property++;
+ return $obj;
+}
+
+function &get_instance_noref() {
+ static $obj;
+
+ echo 'Static object: ';
+ var_dump($obj);
+ if (!isset($obj)) {
+ // 将一个对象赋值给静态变量
+ $obj = new stdclass;
+ }
+ $obj->property++;
+ return $obj;
+}
+
+$obj1 = get_instance_ref();
+$still_obj1 = get_instance_ref();
+echo "\n";
+$obj2 = get_instance_noref();
+$still_obj2 = get_instance_noref();
+?>
+]]>
+ </programlisting>
+ </informalexample>
+
+ &example.outputs;
+
+ <screen>
+Static object: NULL
+Static object: NULL
+
+Static object: NULL
+Static object: object(stdClass)(1) {
+ ["property"]=>
+ int(1)
+}
+ </screen>
+
+ <simpara>
+ 上例演示了当把一个引用赋值给一个静态变量时,第二次调用
+ <literal>&amp;get_instance_ref()</literal> 函数时其值并没有被
<emphasis>记住</emphasis>。
+ </simpara>
+ </sect2>
+ </sect1>
+
+ <sect1 xml:id="language.variables.variable">
+ <title>可变变量</title>
+
+ <simpara>
+ 有时候使用可变变量名是很方便的。就是说,一个变量的变量名可以动态的设置
和使用。一个普通的变量通过声明来设置,例如:
+ </simpara>
+
+ <informalexample>
+ <programlisting role="php">
+<![CDATA[
+<?php
+$a = 'hello';
+?>
+]]>
+ </programlisting>
+ </informalexample>
+
+ <simpara>
+ 一个可变变量获取了一个普通变量的值作为这个可变变量的变量名。在上面的例
子中
+ <emphasis>hello</emphasis> 使用了两个美元符号($)以后,就可以作为一个
可变变量的变量了。例如:
+ </simpara>
+
+ <informalexample>
+ <programlisting role="php">
+<![CDATA[
+<?php
+$$a = 'world';
+?>
+]]>
+ </programlisting>
+ </informalexample>
+
+ <simpara>
+ 这时,两个变量都被定义了:<varname>$a</varname> 的内容是"hello"并且
+ <varname>$hello</varname> 的内容是"world"。因此,可以表述为:
+ </simpara>
+
+ <informalexample>
+ <programlisting role="php">
+<![CDATA[
+<?php
+echo "$a ${$a}";
+?>
+]]>
+ </programlisting>
+ </informalexample>
+
+ <simpara>
+ 以下写法更准确并且会输出同样的结果:
+ </simpara>
+
+ <informalexample>
+ <programlisting role="php">
+<![CDATA[
+<?php
+echo "$a $hello";
+?>
+]]>
+ </programlisting>
+ </informalexample>
+
+ <simpara>
+ 它们都会输出:<computeroutput>hello world</computeroutput>。
+ </simpara>
+
+ <simpara>
+ 要将可变变量用于数组,必须解决一个模棱两可的问题。这就是当写下
+ <varname>$$a[1]</varname>
+ 时,解析器需要知道是想要
+ <varname>$a[1]</varname>
+ 作为一个变量呢,还是想要
+ <varname>$$a</varname>
+ 作为一个变量并取出该变量中索引为 [1]
+ 的值。解决此问题的语法是,对第一种情况用
+ <varname>${$a[1]}</varname>,对第二种情况用
+ <varname>${$a}[1]</varname>。
+ </simpara>
+
+ <warning>
+ <simpara>
+ 注意,在 PHP 的函数和类的方法中,<link
+ linkend="language.variables.superglobals">超全局变量</link>不能用作可
变变量。
+ </simpara>
+ </warning>
+
+ </sect1>
+
+ <sect1 xml:id="language.variables.external">
+ <title>来自 PHP 之外的变量</title>
+
+ <sect2 xml:id="language.variables.external.form">
+ <title>HTML 表单(GET 和 POST)</title>
+
+ <simpara>
+ 当一个表单体交给 PHP
+ 脚本时,表单中的信息会自动在脚本中可用。有很多方法访问此信息,例如:
+ </simpara>
+
+ <para>
+ <example>
+ <title>一个简单的 HTML 表单</title>
+ <programlisting role="html">
+<![CDATA[
+<form action="foo.php" method="POST">
+ Name: <input type="text" name="username"><br />
+ Email: <input type="text" name="email"><br />
+ <input type="submit" name="submit" value="Submit me!" />
+</form>
+]]>
+ </programlisting>
+ </example>
+ </para>
+
+ <para>
+ 根据特定的设置和个人的喜好,有很多种方法访问 HTML
+ 表单中的数据。例如:
+ </para>
+
+ <para>
+ <example>
+ <title>从一个简单的 POST HTML 表单访问数据</title>
+ <programlisting role="html">
+<![CDATA[
+<?php
+// 自 PHP 4.1.0 起可用
+ echo $_POST['username'];
+ echo $_REQUEST['username'];
+
+ import_request_variables('p', 'p_');
+ echo $p_username;
+// PHP 6以后将无效。自 PHP 5.0.0 起,这些较长的预定义变量
+// 可用 register_long_arrays 指令关闭。
+
+ echo $HTTP_POST_VARS['username'];
+
+// 如果 PHP 指令 register_globals = on 时可用。不过自
+// PHP 4.2.0 起默认值为 register_globals = off。
+// 不提倡使用/依赖此种方法。
+
+ echo $username;
+?>
+]]>
+ </programlisting>
+ </example>
+ </para>
+ <para>
+ 使用 GET 表单也类似,只不过要用适当的 GET 预定义变量。GET
+ 也适用于
+ QUERY_STRING(URL 中在"?"之后的信息)。因此,举例
说,<literal>http://www.example.com/test.php?id=3</literal>
+ 包含有可用 <varname>$_GET['id']</varname>
+ 访问的 GET 数据。参见
+ <link linkend="reserved.variables.request">$_REQUEST</link> 和
+ <function>import_request_variables</function>。
+ </para>
+
+ <note>
+ <para>
+ <link linkend="language.variables.superglobals">超全局数组</link>和
+ <varname>$_POST</varname> 以及 <varname>$_GET</varname> 一样,自
+ PHP 4.1.0 起可用。
+ </para>
+ </note>
+
+ <para>
+ 如上所示,在 PHP 4.2.0 之前 <link
+ linkend="ini.register-globals">register_globals</link>
+ 的默认值是
+ <emphasis>on</emphasis>。PHP
+ 社区鼓励大家不要依赖此指令,建议在编码时假定其为
+ <emphasis>off</emphasis>。
+ </para>
+
+ <note>
+ <para>
+ <link linkend="ini.magic-quotes-gpc">magic_quotes_gpc</link>
+ 配置指令影响到
+ Get,Post 和 Cookie 的值。如果打开,值 (It's "PHP!") 会自动转换成
+ (It\'s \"PHP!\")。数据库的插入就需要转义。参见
+ <function>addslashes</function>,<function>stripslashes</function> 和
+ <link linkend="ini.magic-quotes-sybase">magic_quotes_sybase</link>。
+ </para>
+ </note>
+
+ <simpara>
+ PHP 也懂得表单变量上下文中的数组(参见<link
+ linkend="faq.html">相关常见问题</link>)。例如可以将相关的变量编成
组,或者用此特性从多选输入框中取得值。例如,将一个表单 POST 给自己并在提交时
显示数据:
+ </simpara>
+
+ <para>
+ <example>
+ <title>更复杂的表单变量</title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+if (isset($_POST['action']) && $_POST['action'] == 'submitted') {
+ echo '<pre>';
+
+ print_r($_POST);
+ echo '<a href="'. $_SERVER['PHP_SELF'] .'">Please try again</a>';
+
+ echo '</pre>';
+} else {
+?>
+<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
+ Name: <input type="text" name="personal[name]"><br />
+ Email: <input type="text" name="personal[email]"><br />
+ Beer: <br>
+ <select multiple name="beer[]">
+ <option value="warthog">Warthog</option>
+ <option value="guinness">Guinness</option>
+ <option value="stuttgarter">Stuttgarter Schwabenbr</option>
+ </select><br />
+ <input type="hidden" name="action" value="submitted" />
+ <input type="submit" name="submit" value="submit me!" />
+</form>
+<?php
+}
+?>
+]]>
+ </programlisting>
+ </example>
+ </para>
+
+ <sect3 xml:id="language.variables.external.form.submit">
+ <title>IMAGE SUBMIT 变量名</title>
+
+ <simpara>
+ 当提交表单时,可以用一幅图像代替标准的提交按钮,用类似这样的标记:
+ </simpara>
+
+ <informalexample>
+ <programlisting role="html">
+<![CDATA[
+<input type="image" src="image.gif" name="sub" />
+]]>
+ </programlisting>
+ </informalexample>
+
+ <simpara>
+ 当用户点击到图像中的某处时,相应的表单会被传送到服务器,并加上两个变

+ sub_x 和 sub_y。它们包含了用户点击图像的坐标。有经验的用户可能会注意
到被浏览器发送的实际变量名包含的是一个点而不是下划线(即
+ sub.x 和 sub.y),但 PHP 自动将点转换成了下划线。
+ </simpara>
+ </sect3>
+
+ </sect2>
+
+ <sect2 xml:id="language.variables.external.cookies">
+ <title>HTTP Cookies</title>
+
+ <simpara>
+ PHP 透明地支持 <link
+ xlink:href="&url.rfc;6265">RFC 6265</link>定义中的
+ HTTP cookies。Cookies
+ 是一种在远端浏览器端存储数据并能追踪或识别再次访问的用户的机制。可以用
+ <function>setcookie</function>
+ 函数设定 cookies。Cookies 是
+ HTTP 信息头中的一部分,因此
+ SetCookie 函数必须在向浏览器发送任何输出之前调用。对于
+ <function>header</function> 函数也有同样的限制。Cookie
+ 数据会在相应的 cookie 数据数组中可用,例如
+ <varname>$_COOKIE</varname>,<varname>$HTTP_COOKIE_VARS</varname> 和
+ <varname>$_REQUEST</varname>。更多细节和例子见
+ <function>setcookie</function> 手册页面。
+ </simpara>
+
+ <simpara>
+ 如果要将多个值赋给一个 cookie 变量,必须将其赋成数组。例如:
+ </simpara>
+
+ <informalexample>
+ <programlisting role="php">
+<![CDATA[
+<?php
+ setcookie("MyCookie[foo]", 'Testing 1', time()+3600);
+ setcookie("MyCookie[bar]", 'Testing 2', time()+3600);
+?>
+]]>
+ </programlisting>
+ </informalexample>
+
+ <simpara>
+ 这将会建立两个单独的 cookie,尽管 MyCookie
+ 在脚本中是一个单一的数组。如果想在仅仅一个 cookie
+ 中设定多个值,考虑先在值上使用
+ <function>serialize</function> 或
+ <function>explode</function>。
+ </simpara>
+
+ <simpara>
+ 注意在浏览器中一个 cookie 会替换掉上一个同名的
+ cookie,除非路径或者域不同。因此对于购物车程序可以保留一个计数器并一起
传递,例如:
+ </simpara>
+
+ <example>
+ <title>一个 <function>setcookie</function> 的示例</title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+if (isset($_COOKIE['count'])) {
+ $count = $_COOKIE['count'] + 1;
+} else {
+ $count = 1;
+}
+setcookie('count', $count, time()+3600);
+setcookie("Cart[$count]", $item, time()+3600);
+?>
+]]>
+ </programlisting>
+ </example>
+
+ </sect2>
+
+ <sect2 xml:id="language.variables.external.dot-in-names">
+ <title>变量名中的点</title>
+
+ <para>
+ 通常,PHP 不会改变传递给脚本中的变量名。然而应该注意到点(句号)不是
+ PHP 变量名中的合法字符。至于原因,看看:
+ <programlisting role="php">
+<![CDATA[
+<?php
+$varname.ext; /* 非法变量名 */
+?>
+]]>
+ </programlisting>
+ 这时,解析器看到是一个名为
+ <varname>$varname</varname>
+ 的变量,后面跟着一个字符串连接运算符,后面跟着一个裸字符串(即没有加引
号的字符串,且不匹配任何已知的健名或保留字)'ext'。很明显这不是想要的结果。
+ </para>
+
+ <para>
+ 出于此原因,要注意 PHP
+ 将会自动将变量名中的点替换成下划线。
+ </para>
+
+ </sect2>
+
+ <sect2 xml:id="language.variables.determining-type-of">
+ <title>确定变量类型</title>
+
+ <para>
+ 因为 PHP 会判断变量类型并在需要时进行转换(通常情况下),因此在某一时
刻给定的变量是何种类型并不明显。PHP
+ 包括几个函数可以判断变量的类型,例
如:<function>gettype</function>,<function>is_array</function>,<function>is_float</function>,<function>is_int</function>,<function>is_object</function>

+ <function>is_string</function>。参见<link
+ linkend="language.types">类型</link>一章。
+ </para>
+ </sect2>
+
+ </sect1>
+
+ </chapter>
+
+<!-- Keep this comment at the end of the file
+Local variables:
+mode: sgml
+sgml-omittag:t
+sgml-shorttag:t
+sgml-minimize-attributes:nil
+sgml-always-quote-attributes:t
+sgml-indent-step:1
+sgml-indent-data:t
+indent-tabs-mode:nil
+sgml-parent-document:nil
+sgml-default-dtd-file:"~/.phpdoc/manual.ced"
+sgml-exposed-tags:nil
+sgml-local-catalogs:nil
+sgml-local-ecat-files:nil
+End:
+vim600: syn=xml fen fdm=syntax fdl=2 si
+vim: et tw=78 syn=sgml
+vi: ts=1 sw=1
+-->
=======================================
--- /dev/null
+++ /trunk/xml/language-snippets.ent Mon Apr 9 09:11:24 2012
@@ -0,0 +1,1360 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- $Revision: 324974 $ -->
+<!-- EN-Revision: 324832 Maintainer: HonestQiao Status: ready -->
+<!-- Reviewed: no Maintainer: HonestQiao -->
+<!-- Keep 'em sorted -->
+
+<!ENTITY changelog.randomseed '<row
xmlns="http://docbook.org/ns/docbook"><entry>4.2.0</entry><entry>随机数发生
器自动进行播种。</entry></row>'>
+
+<!ENTITY installation.enabled.disable '此扩展默认为启用,编译时可通过下列选
项禁用:'>
+
+<!-- Notes -->
+
+<!ENTITY note.regex.deprecated '<note
xmlns="http://docbook.org/ns/docbook"><para>在 PHP 5.3.0 中,
+已放弃使用 regex 扩展而建议使用<link linkend="book.pcre">PCRE扩展</link>。
+调用此函数将会发出 <constant>E_DEPRECATED</constant> 通知。
+参见"<link linkend="reference.pcre.pattern.posix">差异列表</link>"
+可帮助你转为使用 PCRE。</para></note>'>
+
+
+<!ENTITY note.bin-safe '<note
xmlns="http://docbook.org/ns/docbook"><simpara>此函数可安全用于二进制对象。
</simpara></note>'>
+
+
+<!ENTITY note.clearstatcache '<note
xmlns="http://docbook.org/ns/docbook"><simpara>此函数的结果会被缓存。参见
+<function>clearstatcache</function> 以获得更多细节。</simpara></note>'>
+
+
+<!ENTITY note.context-support '<note
xmlns="http://docbook.org/ns/docbook"><simpara>在 PHP 5.0.0 中增加了 对上下
文(Context)的支持。
+有关 <literal>上下文(Context)</literal> 的说明参见 <xref
linkend="book.stream"/>。</simpara></note>'>
+
+<!ENTITY note.exec-bg '<note xmlns="http://docbook.org/ns/docbook"><para>如
何程序使用此函数启动,为了能保持在后台运行,此程序必须将输出重定向到文件或其
它输出流。
+否则会导致 PHP 挂起,直至程序执行结束。</para></note>'>
+
+<!ENTITY note.func-callback '<note
xmlns="http://docbook.org/ns/docbook"><simpara>除了函数名,含有对象引用的数
组和方法名也可以作为参数。</simpara></note>'>
+
+<!ENTITY note.func-callback-exceptions '<note
xmlns="http://docbook.org/ns/docbook"><para>在函数中注册有多个回调内容时(如
使用
+<function>call_user_func</function> 与
<function>call_user_func_array</function>),如在前一个回调中有未捕获的异
常,其后的将不再被调用。</para></note>'>
+
+<!ENTITY note.funcbyref '<note
xmlns="http://docbook.org/ns/docbook"><para>如果参数以引用方式传递,
+函数对该参数的任何改变将在函数返回后保留。</para></note>'>
+
+<!ENTITY note.funcnoparam '<note
xmlns="http://docbook.org/ns/docbook"><para>因为函数依赖于当前作用域以确定参
数的细节,
+所以在 5.3.0 以前的版本中不能用作函数的参数。如必须传递此值时,可将结果赋与
一个变量,然后用此变量进行传递。</para></note>'>
+
+<!ENTITY note.line-endings '<note
xmlns="http://docbook.org/ns/docbook"><simpara>在读取在 Macintosh 电脑中或由
其创建的文件时, 如果 PHP
+不能正确的识别行结束符,启用运行时配置可选项 <link
linkend="ini.auto-detect-line-endings">auto_detect_line_endings</link>
+也许可以解决此问题。</simpara></note>'>
+
+<!ENTITY note.no-remote '<note
xmlns="http://docbook.org/ns/docbook"><simpara>此函数不能作用于<link
+linkend="features.remote-files">远程文件</link>,被检查的文件必须是可通过服
务器的文件系统访问的。</simpara></note>'>
+
+<!ENTITY note.not-bin-safe '<warning
xmlns="http://docbook.org/ns/docbook"><simpara>此函数(还)不能安全地适用于二
进制对象!</simpara></warning>'>
+
+<!ENTITY note.no-key-association '<note
xmlns="http://docbook.org/ns/docbook"><simpara>此函数为
<parameter>array</parameter>
+中的元素赋与新的键名。这将删除原有的键名,而不是仅仅将键名重新排序。
</simpara></note>'>
+
+<!ENTITY note.no-windows '<note
xmlns="http://docbook.org/ns/docbook"><simpara>此函数未在 Windows 平台下实
现。</simpara></note>'>
+
+<!ENTITY note.no-windows.extension '<note
xmlns="http://docbook.org/ns/docbook"><simpara>此扩展在 Windows 平台上不可
用。</simpara></note>'>
+
+<!ENTITY note.randomseed '<note
xmlns="http://docbook.org/ns/docbook"><simpara>自 PHP 4.2.0 起,不再需要用
+<function>srand</function> 或 <function>mt_srand</function>
+给随机数发生器播种 ,因为现在是由系统自动完成的。</simpara></note>'>
+
+<!ENTITY note.registerglobals '<note
xmlns="http://docbook.org/ns/docbook"><title>register_globals 重要说
明:</title>
+<para>自 PHP 4.2.0 起,PHP 指令
+<link linkend="ini.register-globals">register_globals</link> 的默认值为
<emphasis>off</emphasis>。
+PHP 社区鼓励开发者不要依赖于此指令, 用其他手段替代,例如
&link.superglobals;。</para></note>'>
+
+<!ENTITY note.is-superglobal "<note
xmlns='http://docbook.org/ns/docbook'><para>"Superglobal"也称为自动化的全局
变量。
+这就表示其在脚本的所有作用域中都是可用的。不需要在函数或方法中用
<command>global $variable;</command> 来访问它。</para></note>">
+
+<!ENTITY note.superglobals '<note
xmlns="http://docbook.org/ns/docbook"><title>Superglobal 可用性说明:</title>
+<para>自 PHP 4.1.0 起可以使用 Superglobal 数组,例如
<varname>$_GET</varname>,<varname>$_POST</varname>,和
+<varname>$_SERVER</varname>,等等。更多信息请阅读手册中的
&link.superglobals; 章节。</para></note>'>
+
+<!ENTITY note.uses-ob '<note xmlns="http://docbook.org/ns/docbook"><para>此
函数使用其参数内部的输出缓冲,所以不能当作
+<function>ob_start</function> 的回调函数。</para></note>'>
+
+<!ENTITY note.filesystem-time-res '<note
xmlns="http://docbook.org/ns/docbook"><para>注意:不同文件系统对时间的判断方
法可能是不相同的。</para></note>'>
+
+<!ENTITY note.uses-autoload '<note
xmlns="http://docbook.org/ns/docbook"><para>如果此类不是已知类,
+使用此函数会使用任何已注册的 <link
linkend="language.oop5.autoload">autoloader</link>。</para></note>'>
+
+<!ENTITY note.network.header.sapi '<note
xmlns="http://docbook.org/ns/docbook">
+ <para>
+ 数据头只会在SAPI支持时得到处理和输出
+ </para>
+ </note>
+'>
+
+<!ENTITY note.passwordhashing '<note xmlns="http://docbook.org/ns/docbook">
+ <title>Secure password hashing</title>
+ <para>
+ 由于此函数依赖的算法已不足够复杂,不推荐使用此函数对明文密码加密。
+ 详细内容参见<link linkend="faq.passwords.fasthash">这里</link>
+ </para>
+</note>
+'>
+
+<!-- Tips -->
+
+<!ENTITY tip.fopen-wrapper '<tip
xmlns="http://docbook.org/ns/docbook"><simpara>如已启用<link
linkend="ini.allow-url-fopen"
+>fopen 包装器</link>,在此函数中, URL 可作为文件名。关于如何指定文件名详
见 <function>fopen</function>。各种
+wapper 的不同功能请参见 <xref linkend="wrappers"/>,注意其用法及其可提供的
预定义变量。</simpara></tip>'>
+
+<!ENTITY tip.fopen-wrapper.stat '<tip
xmlns="http://docbook.org/ns/docbook"><simpara>自 PHP 5.0.0 起, 此函数也用于
<emphasis>某些</emphasis>
+URL 包装器。请参见 <xref linkend="wrappers"/>以获得支持
<function>stat</function> 系列函数功能的包装器列表。</simpara></tip>'>
+
+<!ENTITY tip.ob-capture '<tip
xmlns="http://docbook.org/ns/docbook"><simpara>和直接将结果输出到浏览器一
样,可使用<link
+linkend="ref.outcontrol">输出控制函数</link>来捕获当前函数的输出,然后(例如
)保存到一个 <type>string</type> 中。</simpara></tip>'>
+
+<!ENTITY tip.userlandnaming '<tip
xmlns="http://docbook.org/ns/docbook"><simpara>请参见<xref
linkend="userlandnaming" />。</simpara></tip>'>
+
+<!-- Warnings -->
+
+<!ENTITY warn.escapeshell '<warning
xmlns="http://docbook.org/ns/docbook"><para>当用户提供的数据传入此函数,使用
+<function>escapeshellarg</function> 或 <function>escapeshellcmd</function>
+来确保用户欺骗系统从而执行任意命令。</para></warning>'>
+
+<!ENTITY warn.experimental '<warning
xmlns="http://docbook.org/ns/docbook"><simpara>此扩展是<emphasis>实验性
</emphasis>的。
+此扩展的表象,包括其函数名称以及其他此扩展的相关文档都可能在未来的 PHP 发布
版本中未通知就被修改。使用本扩展风险自担 。</simpara></warning>'>
+
+<!ENTITY warn.deprecated.feature-5-3-0 '<warning
xmlns="http://docbook.org/ns/docbook"><simpara>自 PHP 5.3.0
+起,已经<emphasis>废弃</emphasis>此特性。强烈建议不要应用此特性 。
</simpara></warning>'>
+
+<!ENTITY warn.deprecated.feature-5-3-0.removed-6-0-0 '<warning
xmlns="http://docbook.org/ns/docbook"><simpara>自 PHP 5.3.0
+起,已经<emphasis>废弃</emphasis>此特性。强烈建议不要应用此特性 。
</simpara></warning>'>
+
+<!ENTITY warn.deprecated.function-5-3-0.removed-6-0-0 '<warning
xmlns="http://docbook.org/ns/docbook"><simpara>自 PHP 5.3.0
+起,已经<emphasis>废弃</emphasis>此函数。强烈建议不要应用此函数 。
</simpara></warning>'>
+
+<!ENTITY removed.php.future '此已废弃的 特性<emphasis
xmlns="http://docbook.org/ns/docbook">即将 </emphasis>被<emphasis
+xmlns="http://docbook.org/ns/docbook">移除</emphasis>。'>
+
+<!ENTITY warn.deprecated.function.removed-5-3-0 '<warning
xmlns="http://docbook.org/ns/docbook"><simpara>自 PHP 5.3.0
+起,已经<emphasis>废弃</emphasis>并<emphasis>移除</emphasis>此函数。
</simpara></warning>'>
+
+<!ENTITY warn.deprecated.alias-5-3-0 '<warning
xmlns="http://docbook.org/ns/docbook"><simpara>自 PHP 5.3.0
+起,已经<emphasis>废弃</emphasis>此别名。强烈建议不要应用此别名 。
</simpara></warning>'>
+
+<!ENTITY warn.deprecated.func-5-4-0 '<warning
xmlns="http://docbook.org/ns/docbook">
+<simpara>自PHP 5.4.0起,此函数已经被<emphasis>废弃</emphasis>。
+强烈建议不要应用此函数 。</simpara></warning>'>
+
+<!ENTITY warn.deprecated.alias-5-4-0 '<warning
xmlns="http://docbook.org/ns/docbook"><simpara>自 PHP 5.4.0
+起,已经<emphasis>废弃</emphasis>此别名。强烈建议不要应用此别名 。
</simpara></warning>'>
+
+<!ENTITY warn.experimental.func '<warning
xmlns="http://docbook.org/ns/docbook"><simpara>此函数是<emphasis>实验性
</emphasis>的。
+此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修
改。使用本扩展风险自担 。</simpara></warning>'>
+
+<!ENTITY warn.imaprecodeyaz '<warning
xmlns="http://docbook.org/ns/docbook"><simpara><link
+linkend="ref.imap">IMAP</link>,<link
linkend="ref.recode">recode</link>,<link linkend="ref.yaz">YAZ</link> 和
<link
+linkend="ref.cyrus">Cyrus</link>扩展不能同时使用,因为它们共享了相同 的内容
符号。注意:Yaz 2.0 及以上版本不存在此问题。</simpara></warning>'>
+
+<!ENTITY warn.install.cgi '<warning
xmlns="http://docbook.org/ns/docbook"><para>服务器使用 CGI 方式进行部署可能
存在几个公开的缺陷。请阅读
+<link linkend="security.cgi-bin">CGI 安全</link>一章 以学习 如何抵御这些攻
击。</para></warning>'>
+
+<!ENTITY note.magicquotes.gpc '<note
xmlns="http://docbook.org/ns/docbook"><title>设置选项说明:
magic_quotes_gpc</title>
+<para>设置选项<link
linkend="ini.magic-quotes-gpc">magic_quotes_gpc</link>默认值为
<literal>on</literal>。相当于对所有 GET, POST, and COOKIE
+数据使用了 <function>addslashes</function>。可以用
<function>stripslashes</function> 来去掉它们。</para></note>'>
+
+<!ENTITY warn.no-win32-fopen-wrapper '<warning
xmlns="http://docbook.org/ns/docbook"><para>Windows 版本的 PHP 在 4.3.0
+版之前不支持通过此函数访问远程文件,即使已经启用 <link
linkend="ini.allow-url-fopen">allow_url_fopen</link>.
+</para></warning>'>
+
+<!ENTITY warn.ssl-non-standard '<warning
xmlns="http://docbook.org/ns/docbook"><para>使用 SSL 时,Microsoft IIS
+会违反协议不发送<literal>close_notify</literal>标记就关闭连接。PHP 会在到达
数据尾端时报告"SSL: Fatal Protocol Error"。
+要解决此问题,<link linkend="ini.error-reporting">error_reporting</link> 应
设定为降低级别至不包含警告。
+PHP 4.3.7 及更高版本可以在使用 <literal>https://</literal> 包装器打开流时检
测出有问题的 IIS 服务器软件 并抑制警告。在使用
+<function>fsockopen</function> 创建 <literal>ssl://</literal> 套接字时, 开
发者需检测并抑制此警告。</para></warning>'>
+
+<!ENTITY warn.undocumented.func '<warning
xmlns="http://docbook.org/ns/docbook"><simpara>本函数还未编写文档,仅有参数
列表。</simpara></warning>'>
+
+<!-- Misc -->
+<!ENTITY version.trunk.after.53 '<emphasis
xmlns="http://docbook.org/ns/docbook">此变更存在于 PHP
+的 <link linkend="about.phpversions">开发版本</link>中,并可能会存在于 5.3
以后版本中。</emphasis>'>
+
+<!ENTITY version.trunk.changelog '特性'>
+
+<!ENTITY no.function.parameters '<para
xmlns="http://docbook.org/ns/docbook">此函数没有参数。</para>'>
+
+<!ENTITY example.outputs '<para xmlns="http://docbook.org/ns/docbook">以上
例程会输出:</para>'>
+
+<!ENTITY example.outputs.53 '<para xmlns="http://docbook.org/ns/docbook">以
上例程在PHP 5.3中的输出:</para>'>
+
+<!ENTITY example.outputs.54 '<para xmlns="http://docbook.org/ns/docbook">以
上例程在PHP 5.4中的输出:</para>'>
+
+<!ENTITY example.outputs.32bit '<para
xmlns="http://docbook.org/ns/docbook">以上例程在 32 位机器上的输出:</para>'>
+
+<!ENTITY example.outputs.64bit '<para
xmlns="http://docbook.org/ns/docbook">以上例程在 64 位机器上的输出:</para>'>
+
+<!ENTITY example.outputs.similar '<para
xmlns="http://docbook.org/ns/docbook">以上例程的输出类似于:</para>'>
+
+<!ENTITY examples.outputs '<para xmlns="http://docbook.org/ns/docbook">以上
例程会输出:</para>'>
+
+<!ENTITY examples.outputs.32bit '<para
xmlns="http://docbook.org/ns/docbook">以上例程在 32 位机器上的输出:</para>'>
+
+<!ENTITY examples.outputs.64bit '<para
xmlns="http://docbook.org/ns/docbook">以上例程在 64 位机器上的输出:</para>'>
+
+<!ENTITY examples.outputs.similar '<para
xmlns="http://docbook.org/ns/docbook">以上例程的输出类似于:</para>'>
+
+<!ENTITY array.resetspointer '<note
xmlns="http://docbook.org/ns/docbook"><simpara>使用此函数后会重置
(<function>reset</function>)<type>array</type> 指针。</simpara></note>'>
+
+<!ENTITY seealso.array.sorting '<link
xmlns="http://docbook.org/ns/docbook" linkend="array.sorting">数组排序函数对
比</link>'>
+
+<!ENTITY seealso.callback '<link xmlns="http://docbook.org/ns/docbook"
linkend="language.types.callback">callback</link> 类型的信息'>
+
+<!ENTITY avail.register-long-arrays '自 PHP 5.0.0 起, 用
+<link xmlns="http://docbook.org/ns/docbook"
linkend="ini.register-long-arrays">register_long_arrays</link> 设置选项可禁

+长类型的 PHP <link xmlns="http://docbook.org/ns/docbook"
linkend="language.variables.predefined">预定义变量</link>数组。'>
+
+<!ENTITY ini.shorthandbytes '<simpara
xmlns="http://docbook.org/ns/docbook">当使用 <type>integer</type>
+时, 其值以字节来衡量。还可以使用在<link
linkend="faq.using.shorthandbytes">FAQ</link>中描述的速记符。</simpara>'>
+
+<!ENTITY info.deprecated.alias '为了向下兼容,可以使用下列已废弃的别名:'>
+
+
+<!ENTITY info.function.alias '此函数是该函数的别名:'>
+
+
+<!ENTITY info.method.alias '此方法是该方法的别名:'>
+
+<!ENTITY info.function.alias.deprecated '<simpara
xmlns="http://docbook.org/ns/docbook">此函数别名已废弃,仅为了向后兼容而保
留。不建议使用此函数,因为将来会从 PHP 中移除。</simpara>'>
+
+<!ENTITY ext.windows.path.dll '为了使此扩展生效,
+<acronym xmlns="http://docbook.org/ns/docbook">DLL</acronym> 文件必须能在
Windows 系统的
+<literal xmlns="http://docbook.org/ns/docbook">PATH</literal> 指示的路径下
找到。如何操作的信息,请参见题为"<link
+xmlns="http://docbook.org/ns/docbook"
linkend="faq.installation.addtopath">如何在 Windows 中将 PHP
+目录加到 PATH 中</link>"的<acronym
xmlns="http://docbook.org/ns/docbook">FAQ</acronym>。虽然将
+DLL 文件从 PHP 文件夹复制到 Windows 系统目录也行,但不建议这样做。
+<emphasis xmlns="http://docbook.org/ns/docbook">此扩展需要下列文件在
<literal>PATH</literal> 路径中:</emphasis>'>
+
+<!ENTITY manual.migration.seealso '参见 PHP 版本迁移指南'>
+
+<!ENTITY style.oop '面向对象风格'>
+<!ENTITY style.procedural '过程化风格'>
+
+<!ENTITY resource '<link xmlns="http://docbook.org/ns/docbook"
linkend="language.types.resource">资源(resource)</link>'>
+
+<!ENTITY foreach '<link xmlns="http://docbook.org/ns/docbook"
linkend="control-structures.foreach">foreach</link>'>
+
+<!ENTITY parameter.context '<literal
xmlns="http://docbook.org/ns/docbook">上下文 (context)</literal>的说明请参考
手册中的 <link
+ xmlns="http://docbook.org/ns/docbook" linkend="context">上下文
(context)</link>章节.'>
+
+<!ENTITY parameter.use_include_path '值 设为 &true; 时, 也会在
+<link xmlns="http://docbook.org/ns/docbook"
linkend="ini.include-path">include_path</link>
+搜索文件名。'>
+
+<!-- Returns -->
+
+<!ENTITY return.falseforfailure ' 或者在失败时返回 &false;'>
+<!ENTITY return.falseforfailure.style.procedural '&style.procedural;在失败
时返回 &false;。'>
+
+<!ENTITY return.success '成功时返回 &true;,&return.falseforfailure;.'>
+
+<!ENTITY return.void '没有返回值。'>
+
+<!ENTITY return.callbacksort '在第一个参数小于,等于或大于第二个参数时,该比
较函数必须返回一个小于,等于或大于0的整数'>
+
+<!ENTITY return.falseproblem '<warning
xmlns="http://docbook.org/ns/docbook"><simpara>此函数可能返回布尔值
+&false;,但也可能返回等同于 &false; 的非布尔值,例如 <literal>0</literal>

+&quot;&quot;(空串)。请阅读 <link
+linkend="language.types.boolean">布尔类型</link>章节以获取更多信息。应使用
<link linkend="language.operators.comparison">===
+运算符</link> 来测试此函数的返回值。</simpara></warning>'>
+
+<!-- OpenSSL -->
+<!ENTITY openssl.param.x509 '<varlistentry
xmlns="http://docbook.org/ns/docbook">
+ <term><parameter>x509</parameter></term>
+ <listitem>
+ <para>参见<link linkend="openssl.certparams">密钥/证书参数</link>以获取有
效值列表。</para>
+ </listitem>
+</varlistentry>'>
+
+<!-- Image (GD) Notes -->
+
+<!ENTITY note.config.t1lib '<note
xmlns="http://docbook.org/ns/docbook"><simpara>此函数仅在 PHP
+编译时指定了 <option role="configure">--with-t1lib[=DIR]</option> 时可用。
</simpara></note>'>
+
+<!ENTITY note.config.jpeg '<note
xmlns="http://docbook.org/ns/docbook"><simpara>JPEG 支持仅在 PHP 与 GD-1.8
或更高版本一起编译时可用.</simpara></note>'>
+
+<!ENTITY note.config.wbmp '<note
xmlns="http://docbook.org/ns/docbook"><simpara>WBMP 支持仅在 PHP 与 GD-1.8
或更高版本一起编译时可用.</simpara></note>'>
+
+<!ENTITY note.bundled.gd '<note
xmlns="http://docbook.org/ns/docbook"><simpara>此函数仅在与 GD 库捆绑编译的
PHP 版本中可用。</simpara></note>'>
+
+<!ENTITY note.freetype '<note
xmlns="http://docbook.org/ns/docbook"><simpara>此函数仅在
+PHP 编译时加入 freetype 支持时有效(<option
role="configure">--with-freetype-dir=DIR</option>)</simpara></note>'>
+
+<!ENTITY note.gd.2 '<note xmlns="http://docbook.org/ns/docbook"><simpara>此
函数需要 GD 2.0.1 或更高版本(推荐 2.0.28 及更高版本)。</simpara></note>'>
+
+<!ENTITY note.gd.notrequired '<note
xmlns="http://docbook.org/ns/docbook"><para>此函数不需要 GD 图象
库.</para></note>'>
+
+<!ENTITY gd.image.description '<varlistentry
xmlns="http://docbook.org/ns/docbook"><term><parameter>image</parameter></term>
+<listitem><para>由图象创建函数(例如
<function>imagecreatetruecolor</function>)返回的图象资源。
</para></listitem></varlistentry>'>
+
+<!ENTITY gd.font.description '<varlistentry
xmlns="http://docbook.org/ns/docbook"><term><parameter>
+font</parameter></term><listitem><para>取值对于内建的 latin2 编码字体可以
是:1、2、3、4、5(更高的数字对应更大的字体),或是其他由
+<function>imageloadfont</function> 注册的字体标识符。
</para></listitem></varlistentry>'>
+
+<!ENTITY gd.return.identifier '成功后返回图象资源,失败后返回 &false; 。'>
+
+<!ENTITY gd.value.red '红色成分的值。'>
+
+<!ENTITY gd.value.green '绿色成分的值。'>
+
+<!ENTITY gd.value.blue '蓝色成分的值。'>
+
+<!ENTITY gd.source.height '源图象的高度。'>
+
+<!ENTITY gd.source.width '源图象的宽度。'>
+
+<!ENTITY gd.image.path '文件保存的路径,如果未设置或为&null;,将会直接输出原
始图象流。'>
+
+<!ENTITY gd.image.new '由文件或URL创建一个新图象'>
+
+<!ENTITY gd.image.source '源图象连接资源'>
+
+<!ENTITY gd.image.destination '目标图象连接资源'>
+
+<!ENTITY gd.image.output '输出图象到浏览器或文件'>
+
+<!ENTITY gd.image.colors '如果图象由文件创建,只有该图象使用到的颜色会被解
析. 仅存在于调色板中的颜色不会被解析.'>
+
+<!ENTITY gd.font.size '字体的尺寸. 根据GD的版本,为像素尺寸(GD1)或点(磅)尺
寸 (GD2).'>
+
+<!-- DBM notes -->
+
+<!ENTITY dbm.dbm-identifier.description '<varlistentry
xmlns="http://docbook.org/ns/docbook"><term><parameter>
+dbm_identifier</parameter></term><listitem><para>DBM 链接标识符,由
<function>dbmopen</function> 返回。</para></listitem></varlistentry>'>
+
+<!-- cURL notes -->
+
+<!ENTITY curl.ch.description '<varlistentry
xmlns="http://docbook.org/ns/docbook"><term><parameter>ch</parameter>
+</term><listitem><para>由 <function>curl_init</function> 返回的 cURL 句柄。
</para></listitem></varlistentry>'>
+
+<!ENTITY curl.mh.description '<varlistentry
xmlns="http://docbook.org/ns/docbook"><term><parameter>mh</parameter>
+</term><listitem><para>由 <function>curl_multi_init</function> 返回的 cURL
多个句柄。</para></listitem></varlistentry>'>
+
+<!-- IMAP notes -->
+
+<!ENTITY imap.imap-stream.description '<varlistentry
xmlns="http://docbook.org/ns/docbook"><term><parameter>
+imap_stream</parameter></term><listitem><para>由
<function>imap_open</function> 返回的 IMAP 流。
</para></listitem></varlistentry>'>
+
+<!ENTITY imap.pattern '<para xmlns="http://docbook.org/ns/docbook">指定在邮
箱层级的何处开始查找。</para>
+<para xmlns="http://docbook.org/ns/docbook">在组成
<parameter>pattern</parameter> 的字符中可使用两个特殊字符:
+&apos;<literal>*</literal>&apos; 和 &apos;<literal>&#37;</literal>&apos;。
+&apos;<literal>*</literal>&apos; 是指返回所有邮箱目录. 如果将
&apos;<literal>*</literal>&apos;作为
+<parameter>pattern</parameter> 参数时, 则会返回整个邮箱层级结构。
+&apos;<literal>&#37;</literal>&apos; 是指只返回当前级次。
+&apos;<literal>&#37;</literal>&apos; 作为 <parameter>pattern</parameter> 参
数则只会返回顶层邮箱;
+&apos;<literal>~/mail/&#37;</literal>&apos; 用于
<literal>UW_IMAPD</literal>
+则会返回名为 <filename>~/mail</filename> 的目录, 但不包含其子目录。
</para>'>
+
+<!-- mbstring notes -->
+
+<!ENTITY note.mbstring.encoding.internal '<note
xmlns="http://docbook.org/ns/docbook"><para><function>mb_regex_encoding</function>
+指定的内部编码或字符编码将会当作此函数用的字符编码。</para></note>'>
+
+<!ENTITY mbstring.encoding.parameter '<para
xmlns="http://docbook.org/ns/docbook"><parameter>encoding</parameter>
+参数为字符编码。如果省略,则使用内部字符编码。</para>'>
+
+<!ENTITY mbstring.warning.e-modifier '<warning
xmlns="http://docbook.org/ns/docbook"><para>处理非信任的输入时从不使用
+<literal>e</literal> 修饰符,就不会转码(即调用
+<function>preg_replace</function>)。不注意 这些会很可能会导致应用程序引发远
程代码执行的漏洞。</para>
+<para>Never use the <literal>e</literal> modifier when working on
untrusted input. No automatic escaping will happen (as known from
<function>preg_replace</function>). Not taking care of this will most
likely create remote code execution vulnerabilities in your
application.</para></warning>'>
+
+ <!-- MCVE notes -->
+
+<!ENTITY mcve.conn.description '<varlistentry
xmlns="http://docbook.org/ns/docbook"><term><parameter>
+conn</parameter></term><listitem><para>由
<function>m_initengine</function> 返回的 MCVE_CONN 资源。
</para></listitem></varlistentry>'>
+
+<!-- memcached notes -->
+
+<!ENTITY memcached.parameter.expiration '到期时间,默认为 0。 更多 信息请参
见<link
+ linkend="memcached.expiration" xmlns="http://docbook.org/ns/docbook">到期
时间</link>。'>
+
+<!ENTITY memcached.parameter.server_key '此键名标识存储值的服务器。'>
+
+<!ENTITY memcached.parameter.items '存放在服务器上的键/值对数组。'>
+
+<!ENTITY memcached.parameter.key '用于存储值的键名。'>
+
+<!ENTITY memcached.parameter.value '存储的值'>
+
+<!ENTITY memcached.result.getresultcode '如需要则使用 <methodname
xmlns="http://docbook.org/ns/docbook">Memcached::getResultCode</methodname>。'>
+
+<!-- geaman notes -->
+
+<!ENTITY gearman.parameter.host '任务服务器主机名。'>
+
+<!ENTITY gearman.parameter.port '任务服务器端口号。'>
+
+<!ENTITY gearman.parameter.functionname '由程序自动执行的已注册函数。'>
+
+<!ENTITY gearman.parameter.workload '被处理的序列化数据'>
+
+<!ENTITY gearman.parameter.data '要完成功能可能需要的附加数据'>
+
+<!ENTITY gearman.parameter.context '与任务关联的应用程序上下文'>
+
+<!ENTITY gearman.parameter.unique '用于标识特定任务的唯一 性ID。'>
+
+<!ENTITY gearman.parameter.jobhandle '由 Gearman 服务器指派的工作句柄'>
+
+<!-- Date and time entities -->
+<!ENTITY date.timezone.intro.title '<title
xmlns="http://docbook.org/ns/docbook">所支持的时区列表</title>'>
+
+<!ENTITY date.timezone.intro "<para
xmlns='http://docbook.org/ns/docbook'>在这你可找到 PHP 所支持的所有时区的列
表,可用于诸如 <function>date_default_timezone_set</function> 等函数。
</para>
+<note xmlns='http://docbook.org/ns/docbook'><simpara>最新版的时区数据库可从
+PECL 的 <link xlink:href='&url.pecl.package.get;timezonedb'
xmlns:xlink='http://www.w3.org/1999/xlink'>timezonedb</link>
+进行安装。</simpara></note>">
+
+<!ENTITY date.timezone.bc '<simpara
xmlns="http://docbook.org/ns/docbook">在此请不要使用任何时区列表(除 UTC 外
),仅用于向后兼容。</simpara>'>
+
+<!ENTITY date.timezone.errors.description '<para
xmlns="http://docbook.org/ns/docbook">
+在每 次调用日期/时间函数时,如果时区无效则会引发
<constant>E_NOTICE</constant> 错误,如果使用系统设定值或
<varname>TZ</varname>
+环境变量,则会引发 <constant>E_STRICT</constant> 或
<constant>E_WARNING</constant> 消息。参见
+<function>date_default_timezone_set</function></para>'>
+
+<!ENTITY date.timezone.errors.changelog '<row
xmlns="http://docbook.org/ns/docbook"><entry>5.1.0</entry><entry><para>
+现在发布 <constant>E_STRICT</constant> 和 <constant>E_NOTICE</constant>
+时区错误。</para></entry></row>'>
+
+<!ENTITY date.timestamp.description '<varlistentry
xmlns="http://docbook.org/ns/docbook"><term><parameter>timestamp</parameter></term><listitem><para>
+可选的 <parameter>timestamp</parameter> 参数是一个 <type>integer</type> 的
Unix
+时间戳,如未指定,参数值默认为当前本地时间。也就是说,其值默认为
+<function>time</function> 的返回值。</para></listitem></varlistentry>'>
+
+<!ENTITY date.datetime.description '<varlistentry
xmlns="http://docbook.org/ns/docbook"><term><parameter>object</parameter></term>
+<listitem><para>仅为过程化风格:由 <function>date_create</function> 返回的
<classname>DateTime</classname> 类型的对象。
</para></listitem></varlistentry>'>
+
+<!ENTITY date.datetime.description.modified '<varlistentry
xmlns="http://docbook.org/ns/docbook"><term><parameter>object</parameter></term>
+<listitem><para>仅过程化风格:由 <function>date_create</function> 返回的
<classname>DateTime</classname> 类型的对象。此函数会修改这个对象。
</para></listitem></varlistentry>'>
+
+<!ENTITY date.datetimezone.description '<varlistentry
xmlns="http://docbook.org/ns/docbook"><term><parameter>
+object</parameter></term><listitem><para>仅过程化风格:由
<function>timezone_open</function> 返回的
+<classname>DateTimeZone</classname> 对象。
</para></listitem></varlistentry>'>
+
+<!ENTITY date.datetime.retval.changelog '<row
xmlns="http://docbook.org/ns/docbook"><entry>5.3.0</entry><entry>将返回值从
&null;改为 <classname>DateTime</classname> 类型。</entry></row>'>
+
+<!ENTITY date.datetime.return.modifiedobjectorfalseforfailure '返回被修改
的 DateTime 对象,&return.falseforfailure;.'>
+
+<!ENTITY date.timezone.dbversion '基于时区数据库版本的列表'>
+
+<!ENTITY date.timezone.africa '非洲'>
+<!ENTITY date.timezone.america '美洲'>
+<!ENTITY date.timezone.antarctica '南极洲'>
+<!ENTITY date.timezone.arctic '北极'>
+<!ENTITY date.timezone.asia '亚洲'>
+<!ENTITY date.timezone.atlantic '大西洋'>
+<!ENTITY date.timezone.australia '澳洲'>
+<!ENTITY date.timezone.europe '欧洲'>
+<!ENTITY date.timezone.indian '印度'>
+<!ENTITY date.timezone.pacific '太平洋地区'>
+<!ENTITY date.timezone.others '其他'>
+
+<!ENTITY date.formats '正确格式的说明详见 <link
xmlns="http://docbook.org/ns/docbook" linkend="datetime.formats">日期与时间
格式</link>.'>
+
+<!ENTITY date.formats.parameter '日期/时间字符串。&date.formats;'>
+
+<!-- DomXml Notes -->
+
+<!ENTITY node.inserted '此节点出现在文档中,除非是用诸如
+<function
xmlns="http://docbook.org/ns/docbook">domnode_append_child</function> 等函数
来将其插入。'>
+
+<!-- Dom Notes -->
+
+<!ENTITY dom.node.inserted '此节点出现在文档中,除非是用诸如
+<function
xmlns="http://docbook.org/ns/docbook">DOMNode->appendChild</function> 等函数
来将其插入。'>
+
+<!ENTITY dom.allowstatic '<para xmlns="http://docbook.org/ns/docbook">此方
法<emphasis>可以</emphasis>被静态调用,但会抛出一个
<constant>E_STRICT</constant>错误.</para>'>
+
+<!ENTITY dom.malformederror '<para xmlns="http://docbook.org/ns/docbook">尽
管非正确格式化的HTML仍应该被成功调入,
+但此函数会在遇到错误标记时产生<constant>E_WARNING</constant>错误.
+<link linkend="function.libxml-use-internal-errors">libxml错误处理函数
</link>
+可以用来处理这类错误.</para>'>
+
+<!-- FileSystem entities -->
+
+<!ENTITY fs.emits.warning.on.failure '<para
xmlns="http://docbook.org/ns/docbook">
+失败时抛出<constant>E_WARNING</constant>警告.
+</para>'>
+
+<!-- FileSystem entities -->
+<!ENTITY fs.validfp.all '<para xmlns="http://docbook.org/ns/docbook">文件指
针必须是有效的,必须指向由
+<function>fopen</function> 或 <function>fsockopen</function> 成功打开的文件
(并还未由 <function>fclose</function> 关闭)。</para>'>
+
+<!ENTITY fs.file.pointer '<para xmlns="http://docbook.org/ns/docbook">文件
系统指针,是典型地由
+<function>fopen</function> 创建的 <type>resource</type>(资源)。</para>'>
+
+<!ENTITY fs.file.32bit '<note
xmlns="http://docbook.org/ns/docbook"><simpara>
+ 因为 PHP 的整数类型是有符号整型而且很多平台使用32位整型,
+ 对2GB以上的文件,一些文件系统函数可能返回无法预期的结果 。
</simpara></note>'>
+
+<!-- GNUPG -->
+
+<!ENTITY gnupg.identifier '<para
xmlns="http://docbook.org/ns/docbook">gnupg 标识符,由对
+<function>gnupg_init</function> 或 <classname>gnupg</classname> 的调用生
成。</para>'>
+
+<!ENTITY gnupg.fingerprint '<para xmlns="http://docbook.org/ns/docbook">指
纹键名。</para>'>
+
+<!-- HaruDoc -->
+<!ENTITY haru.error '<para xmlns="http://docbook.org/ns/docbook">发生错误时
抛出 <classname>HaruException</classname> 异常。</para>'>
+
+<!-- ODBC -->
+<!ENTITY odbc.connection.id '<para
xmlns="http://docbook.org/ns/docbook">ODBC 连接标识符,详见
+<function>odbc_connect</function>。</para>'>
+
+<!ENTITY odbc.parameter.search '此参数接受下列查询模式:"&#x25;" 来匹配零到
多个字符,"_" 来匹配单个字符。'>
+
+<!ENTITY oauth.callback.error '如回调函数无法被调用或未被指定,会引发一个
+<constant xmlns="http://docbook.org/ns/docbook">E_ERROR</constant> 级别的错
误。'>
+
+<!ENTITY oauth.changelog.error.null '以前失败时返回 &null; , 而不是
&false;.'>
+
+<!-- Oracle -->
+<!ENTITY oci.db
+"<para xmlns='http://docbook.org/ns/docbook'
xmlns:xlink='http://www.w3.org/1999/xlink'>包含要连接的
+<literal>Oracle 实例</literal>。可以是<link
xlink:href='&url.oracle.oic.connect;'>Easy Connect 串</link>, 或 是
+<filename>tnsnames.ora</filename>文件中的连接名,或是本地 Oracle 实例名
</para>
+<para xmlns='http://docbook.org/ns/docbook'>如果不指定,PHP 使用环境变量来
确定连接的 <literal>Oracle 实例</literal>,诸如
+<constant>TWO_TASK</constant> (on Linux) 或 <constant>LOCAL</constant>
(on Windows) 与 <constant>ORACLE_SID</constant>等。</para>
+<para xmlns='http://docbook.org/ns/docbook'>
+要使用 Easy Connect 命名方法,PHP 必须与 Oracle 10g 或 更高版本的客户端库进
行链接。Oracle 10g 的 Easy Connect 串格式:
+<emphasis>[//]host_name[:port][/service_name]</emphasis>。Oracle
+11g 则为:
+<emphasis>[//]host_name[:port][/service_name][:server_type][/instance_name]</emphasis>.
+服务名可在数据库服务器机器上运行 Oracle 实用程序 <literal>lsnrctl
status</literal> 找到。
+</para>
+<para xmlns='http://docbook.org/ns/docbook'>
+<filename>tnsnames.ora</filename> 文件可在 Oracle Net 查找路径中,此路径包
括 <filename>$ORACLE_HOME/network/admin</filename>
+和 <filename>/etc</filename>。 另一种方法是设置
<literal>TNS_ADMIN</literal> 以便通过
<filename>$TNS_ADMIN/tnsnames.ora</filename>
+来读取。表确认 web 守护进程可读取此文件。</para>">
+
+<!ENTITY oci.charset "<para xmlns='http://docbook.org/ns/docbook'>使用
Oracle
+客户端库来确定字符集。字符集不需要与数据库的字符集相匹配。如果不匹
配,Oracle
+会尽可能地将数据从数据库字符集进行转换。因为依赖于字符集,可能不能给出可用
的结果。转换也增加一些时间开销。</para>
+<para xmlns='http://docbook.org/ns/docbook'>如果不指定,Oracle 客户端用
<constant>NLS_LANG</constant> 环境变量来决定字符集。</para>
+<para xmlns='http://docbook.org/ns/docbook'>传递此参数可减少连接时间。
</para>">
+
+<!ENTITY oci.sessionmode '<para xmlns="http://docbook.org/ns/docbook">此参
数在 PHP 5 (PECL OCI8 1.1)版本开始可用,并收受下列值:
+<constant>OCI_DEFAULT</constant>,<constant>OCI_SYSOPER</constant> 和
<constant>OCI_SYSDBA</constant>。
+如为<constant>OCI_SYSOPER</constant> 或 <constant>OCI_SYSDBA</constant> 其
中之一,此函数将会使用外部的证书建立有特权的连接。有特权的连接默认是禁用的。
你需要将
+<link linkend="ini.oci8.privileged-connect">oci8.privileged_connect</link>
为 <literal>On</literal> 来启用。</para>
+<para xmlns="http://docbook.org/ns/docbook">PHP 5.3 (PECL OCI8 1.3.4) 引进

+<constant>OCI_CRED_EXT</constant> 模式值。使用外部或操作系统认证必需在
Oracle 数据库中进行配置。
+<constant>OCI_CRED_EXT</constant> 标志只可用于用户为&quot;/&quot;,密码为空
的情况。
+<link linkend="ini.oci8.privileged-connect">oci8.privileged_connect</link>
可为 <literal>On</literal> 或 <literal>Off</literal>。
+</para>
+<para xmlns="http://docbook.org/ns/docbook">
+<constant>OCI_CRED_EXT</constant> 可与
+<constant>OCI_SYSOPER</constant> 或
+<constant>OCI_SYSDBA</constant> 模式组合使用。
+</para>
+<para xmlns="http://docbook.org/ns/docbook">
+<constant>OCI_CRED_EXT</constant> 由于安全的原因不支持 Windows 系统。
+</para>'>
+
+<!ENTITY oci.datatypes '<para xmlns="http://docbook.org/ns/docbook">要获取
OCI8 扩展进行数据类型映射的细节,请参见
+<link linkend="oci8.datatypes"> 驱动所支持的数据类型</link></para>'>
+
+<!ENTITY oci.parameter.connection '<para
xmlns="http://docbook.org/ns/docbook">Oracle 连接标识,由
+<function>oci_connect</function>,<function>oci_pconnect</function>,或
+<function>oci_new_connect</function> 返回。</para>'>
+
+<!ENTITY oci.name.compat.note '在当前版本中,旧的函数名还可以被使用,但已经
被废弃并不建议使用。'>
+
+<!ENTITY oci.availability.note.10g '<note
xmlns="http://docbook.org/ns/docbook"><title>Oracle 版本需求</title>
+<para>当 PHP 是与 Oracle 数据库 10g 及更新版本的 扩展库链接时,此函数可用。
</para></note>'>
+
+<!ENTITY oci.clientinfo.tip '<tip
xmlns="http://docbook.org/ns/docbook"><title>性能</title><para>使用旧版的
OCI8 或 ORACLE 数据库 ,可使用
+Oracle <literal>DBMS_APPLICATION_INFO</literal> 包来设置客户端信息。这比使
用 <function>oci_set_client_info</function> 较低效。</para></tip>'>
+
+<!ENTITY oci.roundtrip.caution '<caution
xmlns="http://docbook.org/ns/docbook"><title>Roundtrip Gotcha</title>
+<para>一些 OCI8 函数会导致 Roundtrips. 对数据库来说当启用结果缓存时,查询可
能不产生Roundtrips。</para></caution>'>
+
+<!ENTITY oci.use.setprefetch '<para xmlns="http://docbook.org/ns/docbook">
+查询返回巨大数量的数据行时,通过增大
+<link linkend="ini.oci8.default-prefetch">oci8.default_prefetch</link>
+值或使用 <function>oci_set_prefetch</function> 可显著提高性能。</para>'>
+
+<!ENTITY oci.arg.statement.id
+"<para xmlns='http://docbook.org/ns/docbook'>有效的 OCI8 报表标识符
+由 <function>oci_parse</function> 创建,被 <function>oci_execute</function>
+或 <literal>REF CURSOR</literal> statement 标识执行。</para>">
+
+<!-- PCNTL Notes -->
+
+<!ENTITY pcntl.parameter.status '<para
xmlns="http://docbook.org/ns/docbook">参数
+<parameter>status</parameter> 是提供给成功调用
<function>pcntl_waitpid</function>
+时的状态参数。</para>'>
+
+<!-- PS Notes -->
+
+<!ENTITY ps.note.visible '<para xmlns="http://docbook.org/ns/docbook">此说
明在文档被打印或显示时不可见,只在文档用 Acrobat Distiller 或 Ghostview 转换
成 PDF 时显示。</para>'>
+
+<!-- XSLT Notes -->
+
+<!ENTITY note.xslt.windows '<note
xmlns="http://docbook.org/ns/docbook"><para>请注意:
+在使用 Windows 时,路径必须由 <literal>file://</literal> 开头。
</para></note>'>
+
+<!-- Notes for safe-mode limited functions: -->
+<!ENTITY note.sm.disabled '<note
xmlns="http://docbook.org/ns/docbook"><simpara>&sm.disabled;</simpara></note>'>
+
+<!ENTITY note.sm.uidcheck '<note
xmlns="http://docbook.org/ns/docbook"><simpara>当启用
+<link linkend="features.safe-mode">安全模式</link>时,
+PHP 会检查被操作的文件或目录是否与被执行的脚本有相同的 UID(所有者)。
</simpara></note>'>
+
+<!ENTITY note.sm.uidcheck.dir '<note
xmlns="http://docbook.org/ns/docbook"><simpara>当启用
+<link linkend="features.safe-mode">安全模式</link>时,
+PHP 会在执行脚本时检查被脚本操作的目录是否与被执行的脚本有相同的 UID(所有
者)。</simpara></note>'>
+
+<!ENTITY note.open-basedir.func '<note
xmlns="http://docbook.org/ns/docbook"><para>此函数受
+<link linkend="ini.open-basedir">open_basedir</link> 影响。</para></note>'>
+
+<!ENTITY note.language-construct '<note
xmlns="http://docbook.org/ns/docbook"><simpara>因为是一个语言构造器而不是一
个函数,不能被
+<link linkend="functions.variable-functions">可变函数</link> 调用。
+</simpara>
+</note>'>
+
+<!-- Common pieces in features/safe-mode.xml
+ Jade doesn't allow in-line entities, so I put them here... Though they
+ should have been inline in safe-mode.xml -->
+<!ENTITY sm.uidcheck '检查被操作的文件或目录是否与被执行的脚本有相同的
UID(所有者)。'>
+
+<!ENTITY warn.sm.exec '<warning
xmlns="http://docbook.org/ns/docbook"><simpara><link
linkend="features.safe-mode">安全模式</link> 启用时,命令字符串会被
+<function>escapeshellcmd</function> 转换。因此,
+<literal>echo y | echo x</literal> 会变成
+<literal>echo y \| echo x</literal>。</simpara></warning>'>
+
+<!ENTITY note.exec-path '<note
xmlns="http://docbook.org/ns/docbook"><simpara><link
linkend="features.safe-mode">安全模式</link> 启用时,可仅可用
+<link linkend="ini.safe-mode-exec-dir">safe_mode_exec_dir</link> 执行文件。
实际上,现在不允许在到可执行的路径中存在 <literal>..</literal> 组件。
</simpara></note>'>
+
+<!ENTITY sm.uidcheck.dir '检查被操作的目录是否与被执行的脚本有相同的
UID(所有者)。'>
+
+<!ENTITY sm.disabled '当 PHP 运行在 <link
xmlns="http://docbook.org/ns/docbook" linkend="features.safe-mode">安全模式
</link> 时,不能使用此函数。'>
+
+<!-- Common pieces in partintro-sections -->
+
+<!ENTITY no.config '<para xmlns="http://docbook.org/ns/docbook">此扩展没有
在 &php.ini;
+中定义配置指令。</para>'>
+
+<!ENTITY no.resource '<para xmlns="http://docbook.org/ns/docbook">此扩展没
有定义资源类型。</para>'>
+<!ENTITY no.constants '<para xmlns="http://docbook.org/ns/docbook">此扩展没
有定义常量。</para>'>
+<!ENTITY no.requirement '<para xmlns="http://docbook.org/ns/docbook">构建此
扩展不需要其他扩展。</para>'>
+<!ENTITY no.install '<para xmlns="http://docbook.org/ns/docbook">使用这些函
数不需要安装,它们是 PHP 核心的一部分。</para>'>
+
+<!-- Used in every chapter that has directive descriptions -->
+<!ENTITY ini.descriptions.title '<para
xmlns="http://docbook.org/ns/docbook">这是配置指令的简短说明。</para>'>
+
+<!-- Common pieces for reference part BEGIN-->
+
+<!-- Used in reference/$extname/ini.xml -->
+<!ENTITY extension.runtime '<simpara xmlns="http://docbook.org/ns/docbook">
+这些函数的行为受 &php.ini; 中的设置影响。
+</simpara>'>
+
+<!ENTITY ini.php.constants '有关 PHP_INI_* 样式的更多详情与定义,见 <xref
xmlns="http://docbook.org/ns/docbook"
linkend="configuration.changes.modes"/>。'>
+
+<!-- Used in reference/$extname/constants.xml -->
+<!ENTITY extension.constants '<simpara
xmlns="http://docbook.org/ns/docbook">下列常量由此扩展定义,且仅在此扩展编译
入 PHP 或在运行时动态载入时可用。</simpara>'>
+
+<!-- For STANDARD Constants used in reference/$extname/constants.xml -->
+<!ENTITY extension.constants.core '<simpara
xmlns="http://docbook.org/ns/docbook">
+下列常量作为 PHP 核心的一部分总是可用的。
+</simpara>'>
+
+<!-- Used in reference/$extname/classes.xml -->
+<!ENTITY extension.classes '<simpara xmlns="http://docbook.org/ns/docbook">
+下列类由此扩展定义,且仅在此扩展编译入 PHP 或在运行时动态载入时可用。
+</simpara>'>
+
+<!ENTITY note.extension.php5 '<note
xmlns="http://docbook.org/ns/docbook"><simpara>
+此扩展需要 PHP 5。</simpara></note>'>
+
+<!-- PDO entities -->
+
+<!ENTITY pdo.driver-constants '<simpara
xmlns="http://docbook.org/ns/docbook">下列常量由此驱动定义,且仅在扩展编译
入 PHP 或在运行时动态载入时可用。另外,使用此驱动时,仅会使用这些驱动特定的
常量。使用其他驱动的驱动特定的常量可能会导致不可预见的情况。
+如果代码可运行于多个驱动,<function>PDO::getAttribute</function> 可被用于获

+<constant>PDO_ATTR_DRIVER_NAME</constant>
+属性以检查驱动。</simpara>'>
+
+<!-- PECL entities -->
+
+<!ENTITY pecl.moved '此 <link xmlns="http://docbook.org/ns/docbook"
xmlns:xlink="http://www.w3.org/1999/xlink"
xlink:href="&url.pecl;">PECL</link> 扩展未与
+PHP 捆绑。'>
+
+<!ENTITY pecl.bundled '此 <link xmlns="http://docbook.org/ns/docbook"
xmlns:xlink="http://www.w3.org/1999/xlink"
xlink:href="&url.pecl;">PECL</link> 扩展未与
+PHP 捆绑。'>
+
+<!ENTITY pecl.info '安装此 PECL 扩展相关的信息可在手册中标题为 <link
xmlns="http://docbook.org/ns/docbook" linkend="install.pecl">PECL 扩展的安装
</link>
+章节中找到。另外的信息,如新的发行版本、下载、源文件、
+Additional information such as new releases,维护人员信息及变更日志等,都在
此处:'>
+
+<!ENTITY pecl.info.dead '此扩展被认为已无人维护及已消亡。然而,此扩展的源代
码还可在
+<acronym xmlns="http://docbook.org/ns/docbook">PECL</acronym>
+<acronym xmlns="http://docbook.org/ns/docbook">SVN</acronym> 找到:'>
+
+<!ENTITY pecl.source.4 '在 PHP 4 中,此 <acronym
xmlns="http://docbook.org/ns/docbook">PECL</acronym> 扩展源代码可在 PHP 源代
码的
+<filename xmlns="http://docbook.org/ns/docbook">ext/</filename>
+目录下或上面的 <acronym
xmlns="http://docbook.org/ns/docbook">PECL</acronym>
+链接中找到。'>
+
+<!ENTITY pecl.windows.4 '在 PHP 4 中,此 <acronym
xmlns="http://docbook.org/ns/docbook">DLL</acronym> 位于 PHP Windows 二进制
下载中的
+<filename xmlns="http://docbook.org/ns/docbook">extensions/</filename> 目
录。'>
+
+<!ENTITY pecl.windows.download '<acronym
+xmlns="http://docbook.org/ns/docbook">PECL</acronym> 扩展的
+<acronym xmlns="http://docbook.org/ns/docbook">DLL</acronym> 当前不可用。参

+<link xmlns="http://docbook.org/ns/docbook"
linkend="install.windows.building">在
+Windows 上构建</link> 章节。'>
+
+<!ENTITY pecl.windows.download.unbundled '&pecl.windows.download;'>
+
+<!ENTITY pecl.moved-ver '此扩展已被移至
+<link xmlns="http://docbook.org/ns/docbook"
xmlns:xlink="http://www.w3.org/1999/xlink"
xlink:href="&url.pecl;">PECL</link> 资源库且不再与 PHP 捆绑。'>
+
+<!-- kept for BC -->
+<!ENTITY note.pecl-php5 '<note
xmlns="http://docbook.org/ns/docbook"><simpara>
+此扩展已在 PHP 5 中移除,并移至
+<link xmlns:xlink="http://www.w3.org/1999/xlink"
xlink:href="&url.pecl;">PECL</link>
+资源库。</simpara></note>'>
+
+<!-- Common pieces for reference part END -->
+
+<!ENTITY windows.builtin '<simpara
xmlns="http://docbook.org/ns/docbook">PHP
+的 Windows 版本已内建对此扩展的支持。不需要载入额外的扩展来使用这些函数。
</simpara>'>
+
+<!-- These are here as helpers for manual consistency and brievety-->
+<!ENTITY safemode '<link xmlns="http://docbook.org/ns/docbook"
linkend="ini.safe-mode">安全模式</link>'>
+
+<!ENTITY sqlsafemode '<link xmlns="http://docbook.org/ns/docbook"
linkend="ini.sql.safe-mode">SQL 安全模式</link>'>
+
+<!-- APD Notes -->
+
+<!ENTITY apd.debug-level.description '<varlistentry
xmlns="http://docbook.org/ns/docbook"><term><parameter>
+debug_level</parameter></term><listitem><para>由加上
<literal>XXX_TRACE</literal>
+常量而形成的整数。</para><para>不建议使用
+<constant>MEMORY_TRACE</constant>。这会很慢且似乎不精确。
+<constant>ASSIGNMENT_TRACE</constant> 还未被实现。</para><para>要打开所有跟
踪功能(TIMING, FUNCTIONS, ARGS SUMMARY (比如 strace -c)) 则使用 99 作为值。
</para>
+</listitem></varlistentry>'>
+
+<!-- BCMath Notes -->
+
+<!ENTITY bc.scale.description '<varlistentry
xmlns="http://docbook.org/ns/docbook"><term><parameter>
+scale</parameter></term><listitem><para>此可选参数用于设置结果中小数点后的
小数位数。
+也可通过使用 <function>bcscale</function> 来设置全局默认的小数位数,用于所
有函数。
+</para></listitem></varlistentry>'>
+
+<!-- CTYPE Notes -->
+<!ENTITY note.ctype.parameter.integer '<note
xmlns="http://docbook.org/ns/docbook"><para>
+如果给出一个 -128 到 255 之间(含)的整数, 将会被解释为该值对应的ASCII字符
(负值将加上 256 以支持扩展ASCII字符).
+其它整数将会被解释为该值对应的十进制字符串.</para></note>'>
+
+<!-- FBSQL Notes -->
+<!ENTITY fbsql.link-identifier.description '<varlistentry
xmlns="http://docbook.org/ns/docbook"><term><parameter>
+link_identifier</parameter></term><listitem><para>由
+<function>fbsql_connect</function> 或
+<function>fbsql_pconnect</function> 返回的 FrontBase 链接标识符.</para>
+<para>如可选并未指定,函数会尝试查找一个到 FrontBase 服务器的开放链接,且如
没有找到这样的链接,会尝试通过不带参数调用
<function>fbsql_connect</function> 来创建一个。</para>
+</listitem></varlistentry>'>
+
+<!ENTITY fbsql.result.description '<varlistentry
xmlns="http://docbook.org/ns/docbook"><term><parameter>
+result</parameter></term><listitem><para>由
<function>fbsql_query</function>
+或 <function>fbsql_db_query</function> 返回的结果标识符
</para></listitem></varlistentry>'>
+
+<!-- GMP Notes -->
+
+<!ENTITY gmp.return 'GMP 数值<type xmlns="http://docbook.org/ns/docbook">资
源</type>.'>
+
+<!ENTITY gmp.parameter '<para xmlns="http://docbook.org/ns/docbook">可以是
一个 GMP
+数据 <type>resouce</type>,或一个可以转换为数值的字符串。</para>'>
+
+<!-- MySQLi Notes -->
+
+<!ENTITY mysqli.result.description '<varlistentry
xmlns="http://docbook.org/ns/docbook"><term><parameter>
+result</parameter></term><listitem><para>仅以过程化样式:由
+<function>mysqli_query</function>,<function>mysqli_store_result</function>

+<function>mysqli_use_result</function>
+返回的结果集标识。</para></listitem></varlistentry>'>
+
+<!ENTITY mysqli.link.description '<varlistentry
xmlns="http://docbook.org/ns/docbook"><term><parameter>
+link</parameter></term><listitem><para>仅以过程化样式:由
+<function>mysqli_connect</function> 或 <function>mysqli_init</function>
+返回的链接标识。</para></listitem></varlistentry>'>
+
+<!ENTITY mysqli.stmt.description '<varlistentry
xmlns="http://docbook.org/ns/docbook"><term><parameter>
+stmt</parameter></term><listitem><para>仅以过程化样式:由
+<function>mysqli_stmt_init</function>
+返回的 statement 标识。</para></listitem></varlistentry>'>
+
+<!ENTITY mysqli.available.mysqlnd '仅可用于 <link
xmlns="http://docbook.org/ns/docbook"
+linkend="book.mysqlnd">mysqlnd</link>。'>
+
+<!ENTITY mysqli.charset.note '<note xmlns="http://docbook.org/ns/docbook">
+<para>MySQLnd always assumes the server default charset. This charset is
sent during connection
+hand-shake/authentication, which mysqlnd will use.</para><para>Libmysql
uses the default charset set in the
+<filename>my.cnf</filename> or by an explicit call to
<function>mysqli_options</function> prior to
+calling <function>mysqli_real_connect</function>, but after
<function>mysqli_init</function>.</para></note>'>
+
+<!-- Notes for SAPI/Apache -->
+<!ENTITY note.apache.nsapi-module '<note
xmlns="http://docbook.org/ns/docbook"><para>从
+PHP 4.3.3 起,也可在 Netscape/iPlanet/SunONE Web 服务器的
+<link linkend="ref.nsapi">NSAPI 服务器模块</link> 使用此函数。
</para></note>'>
+
+<!ENTITY apache.req.module '<simpara
xmlns="http://docbook.org/ns/docbook">、
+仅在将 PHP 安装为 Apache 模块时,支持此函数。</simpara>'>
+
+<!-- SimpleXML Notes -->
+<!ENTITY simplexml.iteration '<note
xmlns="http://docbook.org/ns/docbook"><simpara>SimpleXML
+建起了一个给大多数方法添加迭代属性的规则。不能通过使用
+<function>var_dump</function> 或任何可检查对象的其它东西来查看。
</simpara></note>'>
+
+<!-- SQLite Notes -->
+<!ENTITY sqlite.case-fold '<para xmlns="http://docbook.org/ns/docbook">由
+<constant>SQLITE_ASSOC</constant> 与 <constant>SQLITE_BOTH</constant>
+返回的列名会依照 <link
linkend="ini.sqlite.assoc-case">sqlite.assoc_case</link>
+配置选项的值决定大小写。</para>'>
+
+<!ENTITY sqlite.decode-bin '<para xmlns="http://docbook.org/ns/docbook">当
+<parameter>decode_binary</parameter> 参数设置为 &true;(默认值)时,PHP 会
解码那些由
+<function>sqlite_escape_string</function>
+编码后的二进制数据。通常应保留此值为其默认值,除非要与其他使用 SQLlite 的应
用程序建立的数据交互。</para>'>
+
+<!ENTITY sqlite.no-unbuffered '<note
xmlns="http://docbook.org/ns/docbook"><para>此函数不能用于未缓冲的结果句柄。
</para></note>'>
+
+<!ENTITY sqlite.param-compat '<note
xmlns="http://docbook.org/ns/docbook"><simpara>为兼容其他数据库扩展(比如
MySQL),支持两种可替代的语法。推荐第一种格式,函数的第一个参数是
<parameter>dbhandle</parameter>。</simpara></note>'>
+
+<!ENTITY sqlite.result-type '<para xmlns="http://docbook.org/ns/docbook">可
选的 <parameter>result_type</parameter>
+参数接受常量,且决定返回的数组如何被索引。使用
+<constant>SQLITE_ASSOC</constant> 会仅返回关联索引(已命名字段),而
+<constant>SQLITE_NUM</constant> 会仅返回数值索引。
<constant>SQLITE_BOTH</constant>
+会同时返回关联和数值索引。<constant>SQLITE_BOTH</constant> 是此函数的默认
值。</para>'>
+
+<!-- Database Notes -->
+<!ENTITY database.field-case '<note
xmlns="http://docbook.org/ns/docbook"><simpara>此函数返回的字段名
<emphasis>大小写敏感</emphasis>。</simpara></note>'>
+
+<!ENTITY database.fetch-null '<note
xmlns="http://docbook.org/ns/docbook"><simpara>此函数将 NULL 字段设置为 PHP
&null; 值。</simpara></note>'>
+
+<!-- MSQL Notes -->
+<!-- The msql.*.description entities are used in the parameters refsect1
-->
+<!ENTITY msql.linkid.description '<varlistentry
xmlns="http://docbook.org/ns/docbook"><term><parameter>
+link_identifier</parameter></term><listitem><para>mSQL 连接。如果不指定,则
使用由
+<function>msql_connect</function> 最近打开的连接。如果没有找到该连接,函数
会尝试通过调用
+<function>msql_connect</function> 建立连接并使用它。
+</para></listitem></varlistentry>'>
+
+<!ENTITY msql.result.description '<varlistentry
xmlns="http://docbook.org/ns/docbook"><term><parameter>
+result</parameter></term><listitem><para><type>resource</type>
+型的结果集。此结果集来自对 <function>msql_query</function>
+的调用。</para></listitem></varlistentry>'>
+
+<!ENTITY msql.field-offset.req.description '<varlistentry
xmlns="http://docbook.org/ns/docbook"><term><parameter>
+field_offset</parameter></term><listitem><para>数值型字段偏移量。
+<parameter>field_offset</parameter> 从 <literal>1</literal>
+开始。</para></listitem></varlistentry>'>
+
+<!-- MySQL Notes -->
+<!-- The mysql.*.description entities are used in the parameters refsect1
-->
+<!ENTITY mysql.linkid.description '<varlistentry
xmlns="http://docbook.org/ns/docbook"><term><parameter>
+link_identifier</parameter></term><listitem><para>MySQL
+连接。如不指定连接标识,则使用由 <function>mysql_connect</function>
+最近打开的连接。如果没有找到该连接,会尝试不带参数调用
+<function>mysql_connect</function>
+来创建。如没有找到连接或无法建立连接,则会生成
+<constant>E_WARNING</constant> 级别的错误。</para></listitem>
+</varlistentry>'>
+
+<!ENTITY mysql.linkid-noreopen.description '<varlistentry
+xmlns="http://docbook.org/ns/docbook"><term><parameter>
+link_identifier</parameter></term><listitem><para> MySQL 连接. 如果该连接标
识符未给出, 将使用最近一次<function>mysql_connect</function>建立的连接.
+如果没有找到可使用的连接, 将产生一个 <constant>E_WARNING</constant> 错
误.</para></listitem></varlistentry>'>
+
+<!ENTITY mysql.result.description '<varlistentry
xmlns="http://docbook.org/ns/docbook"><term><parameter>
+result</parameter></term><listitem><para><type>resource</type>
+型的结果集。此结果集来自对 <function>mysql_query</function>
+的调用。</para></listitem></varlistentry>'>
+
+<!ENTITY mysql.field-offset.req.description '<varlistentry
xmlns="http://docbook.org/ns/docbook"><term><parameter>
+field_offset</parameter></term><listitem><para>数值型字段偏移量。
+<parameter>field_offset</parameter> 从 <literal>0</literal> 开始。如果
+<parameter>field_offset</parameter> 不存在,则会发出一个
+<constant>E_WARNING</constant> 级别的错误
</para></listitem></varlistentry>'>
+
+<!-- Sybase Notes -->
+<!ENTITY sybase.ct.only '<note
xmlns="http://docbook.org/ns/docbook"><simpara>此函数仅适用于对 Sybase 使用
CT 库接口,而不适用于 DB 库。</simpara></note>'>
+
+<!ENTITY sybase.db.only '<note
xmlns="http://docbook.org/ns/docbook"><simpara>此函数仅适用于对 Sybase 使用
DB 库接口,而不适用于 CT 库。</simpara></note>'>
+
+<!ENTITY sybase.linkid.description '<varlistentry
xmlns="http://docbook.org/ns/docbook"><term><parameter>
+link_identifier</parameter></term><listitem><para>Sybase
+连接。如不指定连接标识,则使用由
+<function>sybase_connect</function>
+最近打开的连接。如果没有找到该连接,会尝试不带参数调用
+<function>sybase_connect</function>
+来创建。如没有找到连接或无法建立连接,则会生成
+<constant>E_WARNING</constant> 级别的错误。
+</para></listitem>
+</varlistentry>'>
+
+<!-- CPDF Notes -->
+<!ENTITY cpdf.ul '<para xmlns="http://docbook.org/ns/docbook">可选参数
<parameter>mode</parameter>
+决定单位长度。如为 <literal>0</literal> 或省略,则为页面使用的默认单位。其
他情况下,座标用 postscript 点进行度量,而忽略当前单位。</para>'>
+
+<!ENTITY cpdf.mode.description '<varlistentry
xmlns="http://docbook.org/ns/docbook"><term><parameter>
+mode</parameter></term><listitem><para>可选参数 <parameter>mode</parameter>
+决定单位长度。如为 <literal>0</literal> 或省略,则为页面使用的默认单位。其
他情况下,座标用 postscript 点进行度量,而忽略当前单位。</para>
+</listitem></varlistentry>'>
+
+<!ENTITY cpdf.pdf-document.description '<varlistentry
xmlns="http://docbook.org/ns/docbook"><term><parameter>
+pdf_document</parameter></term><listitem><para>文档句柄,由
+<function>cpdf_open</function>返回。</para></listitem></varlistentry>'>
+
+<!-- Xattr entities -->
+<!ENTITY xattr.namespace '<para xmlns="http://docbook.org/ns/docbook">扩展
的属性有两种 不同的命名空间:user 和 root。user 命名空间对所有用户均有
效,而 root
+命名空间仅对拥有 root 权限的用户有效。
+xattr 默认在 user 命名空间上操作,但可使用
+<parameter>flags</parameter> 参数进行更改。</para>'>
+
+<!-- Notes for IPv6 -->
+<!ENTITY ipv6.brackets '<note
xmlns="http://docbook.org/ns/docbook"><simpara>当指定数值型的 IPv6 地址(例
如 <literal>fe80::1</literal>)时必须用方括号将 IP 围起来----例如,
+<literal>tcp://[fe80::1]:80</literal>。</simpara></note>'>
+
+<!ENTITY ipv6.php5 '<note xmlns="http://docbook.org/ns/docbook"><simpara>在
+PHP 5.0.0 开始加入了对 IPv6 的支持。</simpara></note>'>
+
+<!-- Notes for tidy -->
+<!ENTITY note.tidy.ze2 '<note
xmlns="http://docbook.org/ns/docbook"><simpara>此函数仅可用于
+Zend Engine 2 (PHP &gt;= 5.0.0)。</simpara></note>'>
+
+<!ENTITY tidy.object 'The <classname
xmlns="http://docbook.org/ns/docbook">Tidy</classname> 对象。'>
+
+<!ENTITY note.tidy.1only '<note
xmlns="http://docbook.org/ns/docbook"><simpara>此函数仅可在 Tidy 1.0 中有
效。在 Tidy 2.0 中,其已过时并已被移除。</simpara></note>'>
+
+<!ENTITY note.tidy.2only '<note
xmlns="http://docbook.org/ns/docbook"><simpara>可选参数
<parameter>config</parameter> 和 <parameter>encoding</parameter> 是在
+Tidy 2.0 中加入的。</simpara></note>'>
+
+<!ENTITY tidy.conf-enc '<para xmlns="http://docbook.org/ns/docbook">参数
+<parameter>config</parameter> 可传递数组或字符串。如传递字符串,则代表配置
文件名,否则代表选项本身。关于每个选项的说明参见
+<link xmlns:xlink="http://www.w3.org/1999/xlink"
xlink:href="&url.tidy.conf;">&url.tidy.conf;</link></para>
+<para><parameter>encoding</parameter> 参数设置输入/输出文档的编码。
<parameter>encoding</parameter>
+的值可为:
+<literal>ascii</literal>, <literal>latin0</literal>,
<literal>latin1</literal>,
+<literal>raw</literal>, <literal>utf8</literal>,
<literal>iso2022</literal>,
+<literal>mac</literal>, <literal>win1252</literal>,
<literal>ibm858</literal>,
+<literal>utf16</literal>, <literal>utf16le</literal>,
+<literal>utf16be</literal>, <literal>big5</literal> and
+<literal>shiftjis</literal>.</para>'>
+
+<!-- Snippets for the installation section -->
+<!ENTITY warn.apache2.compat '<warning
xmlns="http://docbook.org/ns/docbook"><para>不推荐在使用 Apache 2 的产品中使
用线程化 MPM。应使用预分支 MPM,Apache 2.0 and 2.2
+默认的 MPM。其原因见 FAQ 中的 相关条目
+<link linkend="faq.installation.apache2">使用线程化 MPM 的
+Apache2</link></para></warning>'>
+
+<!ENTITY note.apache.slashes '<note
xmlns="http://docbook.org/ns/docbook"><simpara>记住当在
+Windows 环境下的 Apache 配置文件中添加路径值时,所有的反斜线,如
+<filename>c:\directory\file.ext</filename>,应转换为正斜线:
+<filename>c:/directory/file.ext</filename>。对目录来说,也必须由斜线结尾。
</simpara></note>'>
+
+<!-- Snippets and titles for the contributors section -->
+<!ENTITY Credit.Authors.and.Contributors '作者与贡献者'>
+
+<!ENTITY Credit.Introduction '<para
xmlns="http://docbook.org/ns/docbook">在手册的首页上仅突出了目前最活跃的人
员,但还有更多的贡献者正在帮助我们工作或在过去给项目提供过巨大的帮助。有许多
不知名的人帮助在手册中写下用户评论,并不断地包含在参考中,也很感谢他们的努
力。下面所提供的列表均以字母顺序排序。</para>'>
+
+<!ENTITY Credit.Authors.and.Editors '作者与编辑'>
+
+<!ENTITY Credit.Past.Authors.Text '下列人员曾经或者目前正在为本手册添砖加
瓦:'>
+
+<!ENTITY Credit.Past.Editors.Text '下列人员对本手册做了相当数量的编辑工
作:'>
+
+<!ENTITY Credit.Note.Editors.Title '用户评论维护者'>
+
+<!ENTITY Credit.Note.Editors.Active '目前最活跃的维护者是:'>
+
+<!ENTITY Credit.Note.Editors.Inactive '下列人员为维护用户评论作出了巨大的努
力:'>
+
+<!ENTITY listendand ' 和 '>
+
+<!-- classkit and runkit entities -->
+<!ENTITY note.classkit.selfmanipulation '<note
xmlns="http://docbook.org/ns/docbook"><simpara>此函数不能用来操作当前正常运
行(或运行链上)的方法。</simpara>
+</note>'>
+
+<!ENTITY note.runkit.selfmanipulation '<note
xmlns="http://docbook.org/ns/docbook"><simpara>此函数不能用来操作当前正常运
行(或运行链上)的方法。</simpara>
+</note>'>
+
+<!ENTITY note.runkit.sandbox '<note
xmlns="http://docbook.org/ns/docbook"><simpara>沙箱支持(是
<function>runkit_lint</function>,<function>runkit_lint_file</function>
+函数,与 <classname>Runkit_Sandbox</classname> 类所必需)仅可用于
+PHP 5.1.0 或 PHP 5.0 的特别修补版本,并需启用线程安全。更多信息可参见
runkit 包中的
+<filename>README</filename> 文件。</simpara></note>'>
+
+<!ENTITY note.runkit.internal-override '<note
xmlns="http://docbook.org/ns/docbook"><simpara>默认情况下,仅在用户空间可删
除,重命名,或者修改函数。为了覆盖内部函数,必须启用 &php.ini; 中的
+<literal>runkit.internal_override</literal> 设置。</simpara>
+</note>'>
+
+<!-- SSH2 Extension -->
+<!ENTITY note.ssh2.subsystem.publickey '<note
xmlns="http://docbook.org/ns/docbook"><simpara>公钥子系统用于管理服务器到
<emphasis>已</emphasis>被认证的客户端的公钥。要用公钥认证方法来认证远程系
统,应使用
+<function>ssh2_auth_pubkey_file</function> 函数。</simpara></note>'>
+
***The diff for this file has been truncated for email.***
=======================================
--- /dev/null
+++ /trunk/xml/make_chm_index.html Mon Apr 9 09:11:24 2012
@@ -0,0 +1,61 @@
+<HTML>
+<!-- $Revision: 324974 $ -->
+<!-- EN-Revision: 317718 Maintainer: HonestQiao Status: ready -->
+<!-- Reviewed: no Maintainer: HonestQiao -->
+<HEAD>
+ <META HTTP-EQUIV="content-type" CONTENT="text/html; charset=UTF-8">
+ <TITLE>PHP 手册</TITLE>
+ <LINK REL="STYLESHEET" HREF="style.css">
+</HEAD>
+<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#840084"
ALINK="#0000FF" TOPMARGIN="0" LEFTMARGIN="0">
+<TABLE BORDER="0" WIDTH="100%" HEIGHT="100%" CELLSPACING="0"
CELLPADDING="0">
+<TR><TD COLSPAN="3"><DIV CLASS="NAVHEADER"><TABLE BGCOLOR="#CCCCFF"
BORDER="0"
+CELLPADDING="0" CELLSPACING="0" WIDTH="100%"><TR><TD><TABLE WIDTH="100%"
BORDER="0"
+CELLPADDING="3" CELLSPACING="0"><TR><TH COLSPAN="3">PHP 手册
</TH></TR><TR><TD
+COLSPAN="3" ALIGN="center">&nbsp;</TD></TR></TABLE></TD></TR><TR
BGCOLOR="#333366">
+<TD><IMG SRC="spacer.gif" BORDER="0" WIDTH="1"
HEIGHT="1"><BR></TD></TR></TABLE></DIV></TD></TR>
+<TR><TD><IMG SRC="spacer.gif" WIDTH="10" HEIGHT="1"></TD><TD HEIGHT="100%"
VALIGN="MIDDLE" WIDTH="100%"><BR>
+
+<P><TABLE ALIGN="CENTER">
+<TR><TD ALIGN="CENTER">
+<H1 CLASS="title">PHP 手册</H1>
+<H4 CLASS="EDITEDBY">主要作者:</H4>
+<div class="author">Mehdi Achour</div>
+<div class="author">Friedhelm Betz</div>
+<div class="author">Antony Dovgal</div>
+<div class="author">Nuno Lopes</div>
+<div class="author">Hannes Magnusson</div>
+<div class="author">Georg Richter</div>
+<div class="author">Damien Seguy</div>
+<div class="author">Jakub Vrana</div>
+<H4 CLASS="EDITEDBY">编辑:</H4>
+<H3 CLASS="editor">Philip Olson</H3>
+<H4 CLASS="EDITEDBY">中文文档翻译:</H4>
+<DIV CLASS="editor">王远之</DIV>
+<DIV CLASS="editor">肖理达</DIV>
+<DIV CLASS="editor">肖盛文</DIV>
+<DIV CLASS="editor">黄啸宇</DIV>
+<DIV CLASS="editor">宋琪</DIV>
+<DIV CLASS="editor">陈伯乐</DIV>
+<DIV CLASS="editor">陈浩</DIV>
+<DIV CLASS="editor">陈岗</DIV>
+<DIV CLASS="editor">刘铭</DIV>
+<DIV CLASS="editor">崔岩</DIV>
+<DIV CLASS="editor">吴煊春</DIV>
+<DIV CLASS="editor">乔楚(HonestQiao)</DIV>
+</TD></TR></TABLE>
+<BR><P ALIGN="CENTER">此文件生成于: [GENTIME]<BR>
+访问 <A HREF="http://www.php.net/docs.php">http://www.php.net/docs.php</A>
+获取最新版本。</P>
+
+<BR><P CLASS="copyright" ALIGN="CENTER">PHP 文档组<A
HREF="copyright.html">版权</A>所有
+(c) 1997 - <?dbtimestamp format="Y"?></P>
+
+</TD><TD><IMG SRC="spacer.gif" WIDTH="10" HEIGHT="1"></TD></TR>
+<TR><TD COLSPAN="3"><DIV CLASS="NAVFOOTER"><TABLE BGCOLOR="#CCCCFF"
BORDER="0"
+CELLPADDING="0" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#333366">
+<TD><IMG SRC="spacer.gif" BORDER="0" WIDTH="1" HEIGHT="1"><BR></TD></TR>
+<TR><TD><TABLE WIDTH="100%" BORDER="0" CELLPADDING="3" CELLSPACING="0">
+<TR><TD COLSPAN="3">&nbsp;</TD></TR><TR><TD COLSPAN="3"
ALIGN="center">&nbsp;</TD>
+</TR></TABLE></TD></TR></TABLE></DIV></TD></TR></TABLE>
+</BODY></HTML>
=======================================
--- /dev/null
+++ /trunk/xml/reference/apache/functions/apache-note.xml Mon Apr 9
09:11:24 2012
@@ -0,0 +1,144 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- $Revision: 324974 $ -->
+<!-- EN-Revision: 323349 Maintainer: HonestQiao Status: ready -->
+<!-- Reviewed: no Maintainer: HonestQiao -->
+<refentry xml:id="function.apache-note"
xmlns="http://docbook.org/ns/docbook">
+ <refnamediv>
+ <refname>apache_note</refname>
+ <refpurpose>取得或设置 apache 请求记录</refpurpose>
+ </refnamediv>
+
+ <refsect1 role="description">
+ &reftitle.description;
+ <methodsynopsis>
+ <type>string</type><methodname>apache_note</methodname>
+
<methodparam><type>string</type><parameter>note_name</parameter></methodparam>
+ <methodparam
choice="opt"><type>string</type><parameter>note_value</parameter></methodparam>
+ </methodsynopsis>
+ <para>
+ <function>apache_note</function> 是用于 Apache
+ 的函数,可以取得或者设置请求
+ <literal>notes</literal> 表中的值。 </para>
+ </refsect1>
+
+ <refsect1 role="parameters">
+ &reftitle.parameters;
+ <para>
+ <variablelist>
+ <varlistentry>
+ <term><parameter>note_name</parameter></term>
+ <listitem>
+ <para>
+ note 名。
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><parameter>note_value</parameter></term>
+ <listitem>
+ <para>
+ note 值。
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </para>
+ </refsect1>
+
+ <refsect1 role="returnvalues">
+ &reftitle.returnvalues;
+ <para>
+ 如果只有一个参数调用,则返回记录
+ <literal>note_name</literal> 的当前值。如果用两个参数调用,则将记录
+ <literal>note_name</literal> 的值设为
+ <literal>note_value</literal> 并返回记录
+ <literal>note_name</literal> 的前一个值。如果未能获取记录,则返回
&false;。
+ </para>
+ </refsect1>
+
+ <refsect1 role="examples">
+ &reftitle.examples;
+ <para>
+ <example>
+ <title>Passing information between PHP and Perl</title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+
+apache_note('name', 'Fredrik Ekengren');
+
+// Call perl script
+virtual("/perl/some_script.pl");
+
+$result = apache_note("resultdata");
+?>
+]]>
+ </programlisting>
+ <programlisting role="perl">
+<![CDATA[
+# Get Apache request object
+my $r = Apache->request()->main();
+
+# Get passed data
+my $name = $r->notes('name');
+
+# some processing
+
+# Pass result back to PHP
+$r->notes('resultdata', $result);
+]]>
+ </programlisting>
+ </example>
+ </para>
+ <para>
+ <example>
+ <title>Logging values in access.log</title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+
+apache_note('sessionID', session_id());
+
+?>
+]]>
+ </programlisting>
+ <programlisting role="apache">
+<![CDATA[
+# "%{sessionID}n" can be used in the LogFormat directive
+]]>
+ </programlisting>
+ </example>
+ </para>
+ </refsect1>
+
+ <refsect1 role="seealso">
+ &reftitle.seealso;
+ <para>
+ <simplelist>
+ <member><function>virtual</function></member>
+ </simplelist>
+ </para>
+ </refsect1>
+
+</refentry>
+
+<!-- Keep this comment at the end of the file
+Local variables:
+mode: sgml
+sgml-omittag:t
+sgml-shorttag:t
+sgml-minimize-attributes:nil
+sgml-always-quote-attributes:t
+sgml-indent-step:1
+sgml-indent-data:t
+indent-tabs-mode:nil
+sgml-parent-document:nil
+sgml-default-dtd-file:"~/.phpdoc/manual.ced"
+sgml-exposed-tags:nil
+sgml-local-catalogs:nil
+sgml-local-ecat-files:nil
+End:
+vim600: syn=xml fen fdm=syntax fdl=2 si
+vim: et tw=78 syn=sgml
+vi: ts=1 sw=1
+-->
=======================================
--- /dev/null
+++ /trunk/xml/reference/apache/ini.xml Mon Apr 9 09:11:24 2012
@@ -0,0 +1,141 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- $Revision: 324974 $ -->
+<!-- EN-Revision: 323642 Maintainer: HonestQiao Status: ready -->
+<!-- Reviewed: no Maintainer: HonestQiao -->
+<section xml:id="apache.configuration"
xmlns="http://docbook.org/ns/docbook">
+ &reftitle.runtime;
+ <para>
+ Apache 的 PHP 模块的行为受 &php.ini; 的设置影响。在 &php.ini;
+ 中的设置可以被服务器配置文件或本地的 &htaccess; 文件中的
+ <link linkend="configuration.changes.apache">php_flag</link>
+ 设置所覆盖。
+ </para>
+ <example>
+ <title>用 &htaccess; 禁用一个目录的 PHP 解析</title>
+ <programlisting>php_flag engine off</programlisting>
+ </example>
+ <para>
+ <table>
+ <title>Apache 配置选项</title>
+ <tgroup cols="4">
+ <thead>
+ <row>
+ <entry>&Name;</entry>
+ <entry>&Default;</entry>
+ <entry>&Changeable;</entry>
+ <entry>&Changelog;</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>engine</entry>
+ <entry>"1"</entry>
+ <entry>PHP_INI_ALL</entry>
+ <entry>自 PHP 4.0.5 起可用</entry>
+ </row>
+ <row>
+ <entry>child_terminate</entry>
+ <entry>"0"</entry>
+ <entry>PHP_INI_ALL</entry>
+ <entry>自 PHP 4.0.5 起可用</entry>
+ </row>
+ <row>
+ <entry>last_modified</entry>
+ <entry>"0"</entry>
+ <entry>PHP_INI_ALL</entry>
+ <entry>自 PHP 4.0.5 起可用</entry>
+ </row>
+ <row>
+ <entry>xbithack</entry>
+ <entry>"0"</entry>
+ <entry>PHP_INI_ALL</entry>
+ <entry>自 PHP 4.0.5 起可用</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ &ini.php.constants;
+ </para>
+
+ &ini.descriptions.title;
+
+ <para>
+ <variablelist>
+ <varlistentry xml:id="ini.engine">
+ <term>
+ <parameter>engine</parameter>
+ <type>boolean</type>
+ </term>
+ <listitem>
+ <para>
+ 打开或关闭 PHP 解析。本指令仅在使用 PHP 的 Apache
+ 模块版本时才有用。可以基于目录或者虚拟主机来打开或者关闭
+ PHP。将 <userinput>engine off</userinput>
+ 放到 &httpd.conf; 文件中适当的位置就可以激活或禁用 PHP。
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry xml:id="ini.child-terminate">
+ <term>
+ <parameter>child_terminate</parameter>
+ <type>boolean</type>
+ </term>
+ <listitem>
+ <para>
+ 指定 PHP 脚本在请求结束后是否可以要求终止子进程。参见
+ <function>apache_child_terminate</function>。
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry xml:id="ini.last-modified">
+ <term>
+ <parameter>last_modified</parameter>
+ <type>boolean</type>
+ </term>
+ <listitem>
+ <para>
+ 在本次请求中发送一个头信息 Last-Modified:,显示 PHP 脚本最后被修改的
日期。
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry xml:id="ini.xbithack">
+ <term>
+ <parameter>xbithack</parameter>
+ <type>boolean</type>
+ </term>
+ <listitem>
+ <para>
+ 不管文件结尾是什么,将文件作为 PHP 以可执行位组来解析。
+<!-- 原文如下,有些不懂。
+ Parse files with executable bit set as PHP regardless of their file
ending.
+-->
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </para>
+
+</section>
+
+<!-- Keep this comment at the end of the file
+Local variables:
+mode: sgml
+sgml-omittag:t
+sgml-shorttag:t
+sgml-minimize-attributes:nil
+sgml-always-quote-attributes:t
+sgml-indent-step:1
+sgml-indent-data:t
+indent-tabs-mode:nil
+sgml-parent-document:nil
+sgml-default-dtd-file:"~/.phpdoc/manual.ced"
+sgml-exposed-tags:nil
+sgml-local-catalogs:nil
+sgml-local-ecat-files:nil
+End:
+vim600: syn=xml fen fdm=syntax fdl=2 si
+vim: et tw=78 syn=sgml
+vi: ts=1 sw=1
+-->
+
+
=======================================
--- /dev/null
+++ /trunk/xml/reference/apd/ini.xml Mon Apr 9 09:11:24 2012
@@ -0,0 +1,93 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- $Revision: 324974 $ -->
+<!-- EN-Revision: 323877 Maintainer: HonestQiao Status: ready -->
+<!-- Reviewed: no Maintainer: HonestQiao -->
+<section xml:id="apd.configuration" xmlns="http://docbook.org/ns/docbook">
+ &reftitle.runtime;
+ &extension.runtime;
+ <para>
+ <table>
+ <title>APD 配置选项</title>
+ <tgroup cols="4">
+ <thead>
+ <row>
+ <entry>&Name;</entry>
+ <entry>&Default;</entry>
+ <entry>&Changeable;</entry>
+ <entry>&Changelog;</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>apd.dumpdir</entry>
+ <entry>NULL</entry>
+ <entry>PHP_INI_ALL</entry>
+ <entry></entry>
+ </row>
+ <row>
+ <entry>apd.statement_tracing</entry>
+ <entry>"0"</entry>
+ <entry>PHP_INI_ALL</entry>
+ <entry></entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ &ini.php.constants;
+ </para>
+
+ &ini.descriptions.title;
+
+ <para>
+ <variablelist>
+ <varlistentry xml:id="ini.apd.dumpdir">
+ <term>
+ <parameter>apd.dumpdir</parameter>
+ <type>string</type>
+ </term>
+ <listitem>
+ <para>
+ 设定 APD 写入调试输出文件的目录。可以指定绝对路径或相对路径。
+ </para>
+ <para>
+ 可以在 <function>apd_set_pprof_trace</function> 中以参数指定一个不同
目录。
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry xml:id="ini.apd.statement-tracing">
+ <term>
+ <parameter>apd.statement_tracing</parameter>
+ <type>boolean</type>
+ </term>
+ <listitem>
+ <para>
+ 指定是否进行每行的跟踪。将此项打开(设为 1)将影响到程序的性能。
+ </para>
+ </listitem>
+ </varlistentry>
+
+ </variablelist>
+ </para>
+
+</section>
+
+<!-- Keep this comment at the end of the file
+Local variables:
+mode: sgml
+sgml-omittag:t
+sgml-shorttag:t
+sgml-minimize-attributes:nil
+sgml-always-quote-attributes:t
+sgml-indent-step:1
+sgml-indent-data:t
+indent-tabs-mode:nil
+sgml-parent-document:nil
+sgml-default-dtd-file:"~/.phpdoc/manual.ced"
+sgml-exposed-tags:nil
+sgml-local-catalogs:nil
+sgml-local-ecat-files:nil
+End:
+vim600: syn=xml fen fdm=syntax fdl=2 si
+vim: et tw=78 syn=sgml
+vi: ts=1 sw=1
+-->
=======================================
--- /dev/null
+++ /trunk/xml/reference/array/book.xml Mon Apr 9 09:11:24 2012
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- $Revision: 324974 $ -->
+<!-- EN-Revision: 313269 Maintainer: HonestQiao Status: ready -->
+<!-- Reviewed: no Maintainer: HonestQiao -->
+<!-- Purpose: basic.vartype -->
+<!-- Membership: core -->
+
+<book xml:id="book.array" xmlns="http://docbook.org/ns/docbook">
+ <title>数组</title>
+
+ <preface xml:id="intro.array">
+ &reftitle.intro;
+ <para>
+ 这些函数允许你通过不同的方式来使用和操作数组。数组是存储、管理和操作变量
组的必不可少的工具。
+ </para>
+ <para>
+ PHP 支持简单数组和多维数组,数组可由用户自己创建也可以由其它函数创建。有
很多特殊的数据库处理函数可以从数据库查询中返回数组以及一些返回数组的函数。
+ </para>
+ <para>
+ 请参考手册中有关<link linkend="language.types.array">数组</link>的章节来
详细了解
+ PHP 中数组是如何实现及使用的。也可以参考 <link
+ linkend="language.operators.array">数组操作符</link>来了解操作数组的一些
其它方式。
+ </para>
+ </preface>
+
+ &reference.array.setup;
+ &reference.array.constants;
+ &reference.array.sorting;
+ &reference.array.reference;
+
+</book>
+
+<!-- Keep this comment at the end of the file
+Local variables:
+mode: sgml
+sgml-omittag:t
+sgml-shorttag:t
+sgml-minimize-attributes:nil
+sgml-always-quote-attributes:t
+sgml-indent-step:1
+sgml-indent-data:t
+indent-tabs-mode:nil
+sgml-parent-document:nil
+sgml-default-dtd-file:"~/.phpdoc/manual.ced"
+sgml-exposed-tags:nil
+sgml-local-catalogs:nil
+sgml-local-ecat-files:nil
+End:
+vim600: syn=xml fen fdm=syntax fdl=2 si
+vim: et tw=78 syn=sgml
+vi: ts=1 sw=1
+-->
+
=======================================
--- /dev/null
+++ /trunk/xml/reference/array/functions/array-change-key-case.xml Mon Apr
9 09:11:24 2012
@@ -0,0 +1,153 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- $Revision: 324974 $ -->
+<!-- EN-Revision: 297028 Maintainer: HonestQiao Status: ready -->
+<!-- Reviewed: no Maintainer: HonestQiao -->
+<refentry xml:id="function.array-change-key-case"
xmlns="http://docbook.org/ns/docbook">
+ <refnamediv>
+ <refname>array_change_key_case</refname>
+ <refpurpose>返回字符串键名全为小写或大写的数组</refpurpose>
+ </refnamediv>
+ <refsect1 role="description">
+ &reftitle.description;
+ <methodsynopsis>
+ <type>array</type><methodname>array_change_key_case</methodname>
+
<methodparam><type>array</type><parameter>input</parameter></methodparam>
+ <methodparam
choice="opt"><type>int</type><parameter>case</parameter></methodparam>
+ </methodsynopsis>
+ <para>
+ <function>array_change_key_case</function> 将
<parameter>input</parameter>
+ 数组中的所有键名改为全小写或大写。改变是根据后一个选项
<parameter>case</parameter>
+ 参数来进行的。可以在这里用两个常量,<constant>CASE_UPPER</constant> 和
+ <constant>CASE_LOWER</constant>。默认值是
+ <constant>CASE_LOWER</constant>。本函数不改变数字索引。
+ </para>
+ <example>
+ <title><function>array_change_key_case</function> 例子</title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+$input_array = array("FirSt" => 1, "SecOnd" => 4);
+print_r(array_change_key_case($input_array, CASE_UPPER));
+?>
+]]>
+ </programlisting>
+ &example.outputs;
+ <screen>
+<![CDATA[
+Array
+(
+ [FIRST] => 1
+ [SECOND] => 4
+)
+]]>
+ </screen>
+ </example>
+ <para>
+ 如果一个数组中的多个键名经过本函数后变成一样的话(例如
+ "keY" 和 "kEY"),最后一个值将覆盖其它的值。
+ </para>
+ </refsect1>
+
+ <refsect1 role="parameters">
+ &reftitle.parameters;
+ <para>
+ <variablelist>
+
+ <varlistentry>
+ <term><parameter>input</parameter></term>
+ <listitem>
+ <para>
+ The array to work on
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><parameter>case</parameter></term>
+ <listitem>
+ <para>
+ Either <constant>CASE_UPPER</constant> or
+ <constant>CASE_LOWER</constant> (default)
+ </para>
+ </listitem>
+ </varlistentry>
+
+ </variablelist>
+ </para>
+ </refsect1>
+
+ <refsect1 role="returnvalues">
+ &reftitle.returnvalues;
+ <para>
+ Returns an array with its keys lower or uppercased, or &false; if
+ <parameter>input</parameter> is not an array.
+ </para>
+ </refsect1>
+
+ <refsect1 role="errors">
+ &reftitle.errors;
+ <para>
+ Throws <constant>E_WARNING</constant> if <parameter>input</parameter> is
+ not an array.
+ </para>
+ </refsect1>
+
+ <refsect1 role="examples">
+ &reftitle.examples;
+ <para>
+ <example xml:id="function.array-change-key-case.example-1">
+ <title><function>array_change_key_case</function> example</title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+$input_array = array("FirSt" => 1, "SecOnd" => 4);
+print_r(array_change_key_case($input_array, CASE_UPPER));
+?>
+]]>
+ </programlisting>
+ &example.outputs;
+ <screen>
+<![CDATA[
+Array
+(
+ [FIRST] => 1
+ [SECOND] => 4
+)
+]]>
+ </screen>
+ </example>
+ </para>
+ </refsect1>
+
+ <refsect1 role="notes">
+ &reftitle.notes;
+ <note>
+ <para>
+ If an array has indices that will be the same once run through this
+ function (e.g. "<literal>keY</literal>" and "<literal>kEY</literal>"),
+ the value that is later in the array will override other indices.
+ </para>
+ </note>
+ </refsect1>
+ </refentry>
+
+<!-- Keep this comment at the end of the file
+Local variables:
+mode: sgml
+sgml-omittag:t
+sgml-shorttag:t
+sgml-minimize-attributes:nil
+sgml-always-quote-attributes:t
+sgml-indent-step:1
+sgml-indent-data:t
+indent-tabs-mode:nil
+sgml-parent-document:nil
+sgml-default-dtd-file:"~/.phpdoc/manual.ced"
+sgml-exposed-tags:nil
+sgml-local-catalogs:nil
+sgml-local-ecat-files:nil
+End:
+vim600: syn=xml fen fdm=syntax fdl=2 si
+vim: et tw=78 syn=sgml
+vi: ts=1 sw=1
+-->
=======================================
--- /dev/null
+++ /trunk/xml/reference/array/functions/array-chunk.xml Mon Apr 9
09:11:24 2012
@@ -0,0 +1,230 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- $Revision: 324974 $ -->
+<!-- EN-Revision: 320302 Maintainer: HonestQiao Status: ready -->
+<!-- Reviewed: no Maintainer: HonestQiao -->
+<refentry xml:id="function.array-chunk"
xmlns="http://docbook.org/ns/docbook">
+ <refnamediv>
+ <refname>array_chunk</refname>
+ <refpurpose>将一个数组分割成多个</refpurpose>
+ </refnamediv>
+ <refsect1 role="description">
+ &reftitle.description;
+ <methodsynopsis>
+ <type>array</type><methodname>array_chunk</methodname>
+
<methodparam><type>array</type><parameter>input</parameter></methodparam>
+
<methodparam><type>int</type><parameter>size</parameter></methodparam>
+ <methodparam
choice="opt"><type>bool</type><parameter>preserve_keys</parameter></methodparam>
+ </methodsynopsis>
+ <para>
+ <function>array_chunk</function> 将一个数组分割成多个数组,其中每个数
组的单元数目由
+ <parameter>size</parameter> 决定。最后一个数组的单元数目可能会少几个。
得到的数组是一个多维数组中的单元,其索引从零开始。
+ </para>
+ <para>
+ 将可选参数 <parameter>preserve_keys</parameter> 设为 &true;,可以使
PHP
+ 保留输入数组中原来的键名。如果你指定了 &false;,那每个结果数组将用从零
开始的新数字索引。默认值是 &false;。
+ </para>
+ <example>
+ <title><function>array_chunk</function> 例子</title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+$input_array = array('a', 'b', 'c', 'd', 'e');
+print_r(array_chunk($input_array, 2));
+print_r(array_chunk($input_array, 2, true));
+?>
+]]>
+ </programlisting>
+ &example.outputs;
+ <screen>
+<![CDATA[
+Array
+(
+ [0] => Array
+ (
+ [0] => a
+ [1] => b
+ )
+
+ [1] => Array
+ (
+ [0] => c
+ [1] => d
+ )
+
+ [2] => Array
+ (
+ [0] => e
+ )
+
+)
+Array
+(
+ [0] => Array
+ (
+ [0] => a
+ [1] => b
+ )
+
+ [1] => Array
+ (
+ [2] => c
+ [3] => d
+ )
+
+ [2] => Array
+ (
+ [4] => e
+ )
+
+)
+]]>
+ </screen>
+ </example>
+ </refsect1>
+
+ <refsect1 role="parameters">
+ &reftitle.parameters;
+ <para>
+ <variablelist>
+
+ <varlistentry>
+ <term><parameter>input</parameter></term>
+ <listitem>
+ <para>
+ The array to work on
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><parameter>size</parameter></term>
+ <listitem>
+ <para>
+ The size of each chunk
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><parameter>preserve_keys</parameter></term>
+ <listitem>
+ <para>
+ When set to &true; keys will be preserved.
+ Default is &false; which will reindex the chunk numerically
+ </para>
+ </listitem>
+ </varlistentry>
+
+ </variablelist>
+ </para>
+ </refsect1>
+
+ <refsect1 role="returnvalues">
+ &reftitle.returnvalues;
+ <para>
+ Returns a multidimensional numerically indexed array, starting with
zero,
+ with each dimension containing <parameter>size</parameter> elements.
+ </para>
+ </refsect1>
+
+ <refsect1 role="errors">
+ &reftitle.errors;
+ <para>
+ If <parameter>size</parameter> is less than 1
+ <constant>E_WARNING</constant> will be thrown and &null; returned.
+ </para>
+ </refsect1>
+
+ <refsect1 role="examples">
+ &reftitle.examples;
+ <para>
+ <example>
+ <title><function>array_chunk</function> example</title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+$input_array = array('a', 'b', 'c', 'd', 'e');
+print_r(array_chunk($input_array, 2));
+print_r(array_chunk($input_array, 2, true));
+?>
+]]>
+ </programlisting>
+ &example.outputs;
+ <screen>
+<![CDATA[
+Array
+(
+ [0] => Array
+ (
+ [0] => a
+ [1] => b
+ )
+
+ [1] => Array
+ (
+ [0] => c
+ [1] => d
+ )
+
+ [2] => Array
+ (
+ [0] => e
+ )
+
+)
+Array
+(
+ [0] => Array
+ (
+ [0] => a
+ [1] => b
+ )
+
+ [1] => Array
+ (
+ [2] => c
+ [3] => d
+ )
+
+ [2] => Array
+ (
+ [4] => e
+ )
+
+)
+]]>
+ </screen>
+ </example>
+ </para>
+ </refsect1>
+
+ <refsect1 role="seealso">
+ &reftitle.seealso;
+ <para>
+ <simplelist>
+ <member><function>array_slice</function></member>
+ </simplelist>
+ </para>
+ </refsect1>
+ </refentry>
+
+<!-- Keep this comment at the end of the file
+Local variables:
+mode: sgml
+sgml-omittag:t
+sgml-shorttag:t
+sgml-minimize-attributes:nil
+sgml-always-quote-attributes:t
+sgml-indent-step:1
+sgml-indent-data:t
+indent-tabs-mode:nil
+sgml-parent-document:nil
+sgml-default-dtd-file:"~/.phpdoc/manual.ced"
+sgml-exposed-tags:nil
+sgml-local-catalogs:nil
+sgml-local-ecat-files:nil
+End:
+vim600: syn=xml fen fdm=syntax fdl=2 si
+vim: et tw=78 syn=sgml
+vi: ts=1 sw=1
+-->
=======================================
--- /dev/null
+++ /trunk/xml/reference/array/functions/array-combine.xml Mon Apr 9
09:11:24 2012
@@ -0,0 +1,192 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- $Revision: 324974 $ -->
+<!-- EN-Revision: 312709 Maintainer: HonestQiao Status: ready -->
+<!-- Reviewed: no Maintainer: HonestQiao -->
+<refentry xml:id="function.array-combine"
xmlns="http://docbook.org/ns/docbook">
+ <refnamediv>
+ <refname>array_combine</refname>
+ <refpurpose>
+ 创建一个数组,用一个数组的值作为其键名,另一个数组的值作为其值
+ </refpurpose>
+ </refnamediv>
+ <refsect1 role="description">
+ &reftitle.description;
+ <methodsynopsis>
+ <type>array</type><methodname>array_combine</methodname>
+
<methodparam><type>array</type><parameter>keys</parameter></methodparam>
+
<methodparam><type>array</type><parameter>values</parameter></methodparam>
+ </methodsynopsis>
+ <para>
+ 返回一个 <type>array</type>,用来自
+ <parameter>keys</parameter> 数组的值作为键名,来自
+ <parameter>values</parameter> 数组的值作为相应的值。
+ </para>
+ <para>
+ 如果两个数组的单元数不同或者数组为空时返回 &false;。
+ </para>
+ <para>
+ <example>
+ <title>简单的 <function>array_combine</function> 例子</title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+$a = array('green', 'red', 'yellow');
+$b = array('avocado', 'apple', 'banana');
+$c = array_combine($a, $b);
+
+print_r($c);
+?>
+]]>
+ </programlisting>
+ &example.outputs;
+ <screen>
+<![CDATA[
+Array
+(
+ [green] => avocado
+ [red] => apple
+ [yellow] => banana
+)
+]]>
+ </screen>
+ </example>
+ </para>
+ <para>
+ 参见 <function>array_merge</function>,<function>array_walk</function>
+ 和 <function>array_values</function>。
+ </para>
+ </refsect1>
+
+ <refsect1 role="parameters">
+ &reftitle.parameters;
+ <para>
+ <variablelist>
+
+ <varlistentry>
+ <term><parameter>keys</parameter></term>
+ <listitem>
+ <para>
+ Array of keys to be used. Illegal values for key will be
+ converted to <type>string</type>.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><parameter>values</parameter></term>
+ <listitem>
+ <para>
+ Array of values to be used
+ </para>
+ </listitem>
+ </varlistentry>
+
+ </variablelist>
+ </para>
+ </refsect1>
+
+ <refsect1 role="returnvalues">
+ &reftitle.returnvalues;
+ <para>
+ Returns the combined <type>array</type>, &false; if the number of
elements
+ for each array isn't equal.
+ </para>
+ </refsect1>
+
+ <refsect1 role="errors">
+ &reftitle.errors;
+ <para>
+ Throws <constant>E_WARNING</constant> if the number of elements in
+ <parameter>keys</parameter> and <parameter>values</parameter> does not
+ match.
+ </para>
+ </refsect1>
+
+ <refsect1 role="changelog">
+ &reftitle.changelog;
+ <para>
+ <informaltable>
+ <tgroup cols="2">
+ <thead>
+ <row>
+ <entry>&Version;</entry>
+ <entry>&Description;</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>5.4.0</entry>
+ <entry>
+ Previous versions issued <constant>E_WARNING</constant> and
returned
+ &false; for empty arrays.
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </informaltable>
+ </para>
+ </refsect1>
+
+ <refsect1 role="examples">
+ &reftitle.examples;
+ <para>
+ <example>
+ <title>A simple <function>array_combine</function> example</title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+$a = array('green', 'red', 'yellow');
+$b = array('avocado', 'apple', 'banana');
+$c = array_combine($a, $b);
+
+print_r($c);
+?>
+]]>
+ </programlisting>
+ &example.outputs;
+ <screen>
+<![CDATA[
+Array
+(
+ [green] => avocado
+ [red] => apple
+ [yellow] => banana
+)
+]]>
+ </screen>
+ </example>
+ </para>
+ </refsect1>
+
+ <refsect1 role="seealso">
+ &reftitle.seealso;
+ <para>
+ <simplelist>
+ <member><function>array_merge</function></member>
+ <member><function>array_walk</function></member>
+ <member><function>array_values</function></member>
+ </simplelist>
+ </para>
+ </refsect1>
+ </refentry>
+
+<!-- Keep this comment at the end of the file
+Local variables:
+mode: sgml
+sgml-omittag:t
+sgml-shorttag:t
+sgml-minimize-attributes:nil
+sgml-always-quote-attributes:t
+sgml-indent-step:1
+sgml-indent-data:t
+indent-tabs-mode:nil
+sgml-parent-document:nil
+sgml-default-dtd-file:"~/.phpdoc/manual.ced"
+sgml-exposed-tags:nil
+sgml-local-catalogs:nil
+sgml-local-ecat-files:nil
+End:
+vim600: syn=xml fen fdm=syntax fdl=2 si
+vim: et tw=78 syn=sgml
+vi: ts=1 sw=1
+-->
=======================================
***Additional files exist in this changeset.***
Reply all
Reply to author
Forward
0 new messages