Contributions are ready for review

From: Date: Mon, 02 May 2016 12:00:03 +0000
Subject: Contributions are ready for review
Groups: php.doc.zh 
Request: Send a blank email to doc-zh+get-4658@lists.php.net to get a copy of this message
Hello PHP ZH Documentation team, There are contributions within the online editor queue for this language. Please review, then commit or delete these patches. Patches for review : ----------------------- New file: zh/language/predefined/error.xml By: on 2016-04-27 01:05:09 =================================================================== --- zh/language/predefined/error.xml +++ zh/language/predefined/error.xml @@ -0,0 +1,140 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- $Revision: $ --> +<!-- EN-Revision: 338392 Maintainer: Status: ready --> +<!-- Reviewed: no --> + +<phpdoc:classref xml:id="class.error" + xmlns="http://docbook.org/ns/docbook" + xmlns:xlink="http://www.w3.org/1999/xlink" + xmlns:xi="http://www.w3.org/2001/XInclude" + xmlns:phpdoc="http://php.net/ns/phpdoc"> + <title>Error</title> + <titleabbrev>Error</titleabbrev> + + <partintro> + +<!-- {{{ Error intro --> + <section xml:id="error.intro"> + &reftitle.intro; + <para> + <ooclass><classname>Error</classname></ooclass> 是所有PHP内部错误类的基类。 + </para> + </section> +<!-- }}} --> + + <section xml:id="error.synopsis"> + &reftitle.classsynopsis; + +<!-- {{{ Synopsis --> + <classsynopsis> + <ooclass><classname>Error</classname></ooclass> + +<!-- {{{ Class synopsis --> + <classsynopsisinfo> + <ooclass> + <classname>Error</classname> + </ooclass> + + <ooclass> + <modifier>implements</modifier> + <classname>Throwable</classname> + </ooclass> + </classsynopsisinfo> +<!-- }}} --> + + <classsynopsisinfo role="comment">&Properties;</classsynopsisinfo> + <fieldsynopsis> + <modifier>protected</modifier> + <type>string</type> + <varname linkend="error.props.message">message</varname> + </fieldsynopsis> + <fieldsynopsis> + <modifier>protected</modifier> + <type>int</type> + <varname linkend="error.props.code">code</varname> + </fieldsynopsis> + <fieldsynopsis> + <modifier>protected</modifier> + <type>string</type> + <varname linkend="error.props.file">file</varname> + </fieldsynopsis> + <fieldsynopsis> + <modifier>protected</modifier> + <type>int</type> + <varname linkend="error.props.line">line</varname> + </fieldsynopsis> + + <classsynopsisinfo role="comment">&Methods;</classsynopsisinfo> + <xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.error')/db:refentry/db:refsect1[@role='description']/descendant::db:constructorsynopsis[1])" /> + <xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.error')/db:refentry/db:refsect1[@role='description']/descendant::db:methodsynopsis[1])" /> + </classsynopsis> + +<!-- }}} --> + + </section> + <!-- {{{ Error properties --> + <section xml:id="error.props"> + &reftitle.properties; + <variablelist> + <varlistentry xml:id="error.props.message"> + <term><varname>message</varname></term> + <listitem> + <para>错误消息内容</para> + </listitem> + </varlistentry> + <varlistentry xml:id="error.props.code"> + <term><varname>code</varname></term> + <listitem> + <para>错误代码</para> + </listitem> + </varlistentry> + <varlistentry xml:id="error.props.file"> + <term><varname>file</varname></term> + <listitem> + <para>抛出错误的文件名</para> + </listitem> + </varlistentry> + <varlistentry xml:id="error.props.line"> + <term><varname>line</varname></term> + <listitem> + <para>抛出错误的行数</para> + </listitem> + </varlistentry> + </variablelist> + </section> + <!-- }}} --> + + </partintro> + +&language.predefined.error.construct; +&language.predefined.error.getmessage; +&language.predefined.error.getprevious; +&language.predefined.error.getcode; +&language.predefined.error.getfile; +&language.predefined.error.getline; +&language.predefined.error.gettrace; +&language.predefined.error.gettraceasstring; +&language.predefined.error.tostring; +&language.predefined.error.clone; +</phpdoc:classref> + +<!-- 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 +--> => Put this change into your patches : https://edit.php.net/?project=php&action=putIntoMyPatches&idDB=67044 => Delete this change: https://edit.php.net/?project=php&action=deleteThisChange&idDB=67044 ------------------------------------------------------------------ Modified: zh/extensions.ent By: 徐骁 on 2014-10-11 20:58:15 =================================================================== --- zh/extensions.ent +++ zh/extensions.ent @@ -1,6 +1,8 @@ <?xml version="1.0" encoding="utf-8"?> <!-- $Revision: 334933 $ --> +<!-- EN-Revision: XX Maintainer: 徐骁 Status: ready --> <!-- EN-Revision: 290424 Maintainer: dallas Status: ready --> +<!-- Reviewed: no Maintainer: 徐骁 --> <!-- Entities for the categorized extension list, so it does not need to be translated, and thus it is not going to be outdated. => Put this change into your patches : https://edit.php.net/?project=php&action=putIntoMyPatches&idDB=58792 => Delete this change: https://edit.php.net/?project=php&action=deleteThisChange&idDB=58792 ------------------------------------------------------------------ Modified: zh/language-defs.ent By: 徐骁 on 2014-10-11 21:05:38 =================================================================== --- zh/language-defs.ent +++ zh/language-defs.ent @@ -1,6 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> <!-- $Revision: 334933 $ --> <!-- EN-Revision: 331319 Maintainer: yincheng Status: ready --> +<!-- Reviewed: no Maintainer: 徐骁 --> <!-- Part titles used mostly in manual.xml itself --> <!ENTITY PHPManual "PHP 手册"> <!ENTITY Seealso "参见"> => Put this change into your patches : https://edit.php.net/?project=php&action=putIntoMyPatches&idDB=58793 => Delete this change: https://edit.php.net/?project=php&action=deleteThisChange&idDB=58793 ------------------------------------------------------------------ Modified: zh/language-snippets.ent By: 徐骁 on 2014-10-11 23:29:41 =================================================================== --- zh/language-snippets.ent +++ zh/language-snippets.ent @@ -194,6 +194,11 @@ 起<emphasis>废弃</emphasis>。强烈建议不要使用本特性。</simpara></warning>'> +<!ENTITY warn.deprecated.feature-5-6-0 '<warning +xmlns="http://docbook.org/ns/docbook"><simpara>本特性自 PHP 5.6.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>。'> @@ -284,6 +289,10 @@ <!ENTITY example.outputs.54 '<para xmlns="http://docbook.org/ns/docbook">以上例程在PHP 5.4中的输出:</para>'> +<!ENTITY example.outputs.55 '<para xmlns="http://docbook.org/ns/docbook">以上例程在PHP 5.5中的输出:</para>'> + +<!ENTITY example.outputs.56 '<para xmlns="http://docbook.org/ns/docbook">以上例程在PHP 5.6中的输出:</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>'> @@ -333,11 +342,11 @@ <!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 +<envar xmlns="http://docbook.org/ns/docbook">PATH</envar> 指示的路径下找到。如何操作的信息,请参见题为“<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>'> +<emphasis xmlns="http://docbook.org/ns/docbook">此扩展需要下列文件在 <envar>PATH</envar> 路径中:</emphasis>'> @@ -455,6 +464,13 @@ dbm_identifier</parameter></term><listitem><para>DBM 链接标识符,由 <function>dbmopen</function> 返回。</para></listitem></varlistentry>'> +<!-- JSON notes --> + +<!ENTITY json.implementation.superset '<note xmlns="http://docbook.org/ns/docbook"><para>PHP实现了一个 JSON 的超集 - +支持标量类型和 &null; 类型的编码、解码。 +标准的JSON仅支持包含在数组或者对象实例中的上述类型。 +</para></note>'> + <!-- cURL notes --> <!ENTITY curl.ch.description '<varlistentry xmlns="http://docbook.org/ns/docbook"><term><parameter>ch</parameter> @@ -490,6 +506,10 @@ 指定的内部编码或字符编码将会当作此函数用的字符编码。</para></note>'> +<!ENTITY note.mbstring.encoding.current '<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>'> @@ -531,7 +551,7 @@ <!ENTITY password.parameter.hash '一个由 <function xmlns="http://docbook.org/ns/docbook">password_hash</function> 创建的散列值。'> -<!ENTITY password.parameter.options '一个包含有选项的关联数组。目前支持两个选项:<literal xmlns="http://docbook.org/ns/docbook">salt</literal>,在散列密码时加的盐(干扰字符串),以及<literal xmlns="http://docbook.org/ns/docbook">cost</literal>,用来指明算法递归的层数。这两个值的例子可在 <function xmlns="http://docbook.org/ns/docbook">crypt</function> 页面找到。'> +<!ENTITY password.parameter.options '一个包含有选项的关联数组。 参见 <link xmlns="http://docbook.org/ns/docbook" linkend="password.constants">密码算法常量</link> ,查阅每种算法支持的选项。'> <!ENTITY password.parameter.password '用户的密码。'> @@ -722,9 +742,9 @@ <constant>TWO_TASK</constant>(Linux 下)或 <constant>LOCAL</constant>(Windows 下)与 <constant>ORACLE_SID</constant> 等。 </para> <para xmlns='http://docbook.org/ns/docbook'> - 要使用 Easy Connect 命名方法,PHP 必须与 Oracle 10g 或更高版本的客户端库进行链接。Oracle 10g 的 Easy Connect + 要使用 Easy Connect 命名方法,PHP 必须与 Oracle 10<emphasis>g</emphasis> 或更高版本的客户端库进行链接。Oracle 10<emphasis>g</emphasis> 的 Easy Connect 串格式:<emphasis>[//]host_name[:port][/service_name]</emphasis>。Oracle - 11g 则为:<emphasis>[//]host_name[:port][/service_name][:server_type][/instance_name]</emphasis>。服务名可在数据库服务器机器上运行 + 11<emphasis>g</emphasis> 则为:<emphasis>[//]host_name[:port][/service_name][:server_type][/instance_name]</emphasis>。服务名可在数据库服务器机器上运行 Oracle 实用程序 <literal>lsnrctl status</literal> 找到。 </para> <para xmlns='http://docbook.org/ns/docbook'> @@ -798,11 +818,8 @@ <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>'> +<para>当 PHP 是与 Oracle 数据库 10<emphasis>g</emphasis> 及更新版本的 扩展库链接时,此函数可用。</para></note>'> <!ENTITY oci.clientinfo.tip '<tip xmlns="http://docbook.org/ns/docbook"><title>性能</title> @@ -1046,9 +1063,9 @@ <!-- 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>'> +<!ENTITY gmp.return 'GMP 数值 <type xmlns="http://docbook.org/ns/docbook">资源</type> PHP 5.5 及之前版本,<classname xmlns="http://docbook.org/ns/docbook">GMP</classname>对象 PHP 5.6 及之后版本。'> +<!ENTITY gmp.parameter '<para xmlns="http://docbook.org/ns/docbook">GMP 数值<type>resource</type>在PHP 5.5 及之前版本,或者 <classname>GMP</classname> 对象 PHP 5.6 及之后版本,亦或一个可以转换为数值的字符串。</para>'> + <!-- MySQLi Notes --> <!ENTITY mysqli.result.description '<varlistentry xmlns="http://docbook.org/ns/docbook"><term><parameter> @@ -1383,6 +1400,15 @@ <!ENTITY svn.referto.status '参见 <link xmlns="http://docbook.org/ns/docbook" linkend="svn.constants.status">状态常量列表</link> 获得可能的值.'> <!ENTITY svn.referto.type '参见 <link xmlns="http://docbook.org/ns/docbook" linkend="svn.constants.type">类型常量列表</link> 获取可能的值.'> +<!-- FANN notes --> +<!ENTITY fann.ann.description '<para xmlns="http://docbook.org/ns/docbook">神经网络 <type>resource</type>.</para>'> +<!ENTITY fann.train.description '<para xmlns="http://docbook.org/ns/docbook">神经网络训练数据 <type>resource</type>.</para>'> +<!ENTITY fann.errdat.description '<para xmlns="http://docbook.org/ns/docbook">神经网络 <type>resource</type> 或者 神经网络训练数据 <type>resource</type>.</para>'> +<!ENTITY fann.return.void '<para xmlns="http://docbook.org/ns/docbook">无返回值</para>'> +<!ENTITY fann.return.bool '<para xmlns="http://docbook.org/ns/docbook">成功返回 &true;,其它情况返回 &false; 。</para>'> +<!ENTITY fann.return.ann '<para xmlns="http://docbook.org/ns/docbook"> 成功返回一个神经网络<type>resource</type> ,其它情况返回 &false; 。</para>'> +<!ENTITY fann.return.train '<para xmlns="http://docbook.org/ns/docbook"> 成功返回一个神经网络训练数据<type>resource</type>,其它情况返回 &false; 。</para>'> + <!-- Imagick generic return types --> <!ENTITY imagick.return.success '成功时返回 &true;。'> <!ENTITY imagick.imagick.throws '错误时抛出 ImagickException。'> @@ -1714,11 +1740,140 @@ <!ENTITY mongo.setreadpreference.returnvalues '<para xmlns="http://docbook.org/ns/docbook">Returns &true; on success, or &false; otherwise.</para>'> <!ENTITY mongo.setreadpreference.errors '<para xmlns="http://docbook.org/ns/docbook">Emits <constant>E_WARNING</constant> if either parameter is invalid, or if one or more tag sets are provided with the <constant>MongoClient::RP_PRIMARY</constant> read preference mode.</para>'> <!ENTITY mongo.getreadpreference.returnvalues '<para xmlns="http://docbook.org/ns/docbook">This function returns an array describing the read preference. The array contains the values <literal>type</literal> for the string read preference mode (corresponding to the <classname>MongoClient</classname> constants), and <literal>tagsets</literal> containing a list of all tag set criteria. If no tag sets were specified, <literal>tagsets</literal> will not be present in the array.</para>'> -<!ENTITY mongo.writes.parameters.writeconcern '<listitem xmlns="http://docbook.org/ns/docbook"><para><literal>"w"</literal></para><para>See <link linkend="mongo.writeconcerns">WriteConcerns</link>. The default value for <classname>MongoClient</classname> is <literal>1</literal>.</para></listitem>'> -<!ENTITY mongo.writes.parameters.fsync '<listitem xmlns="http://docbook.org/ns/docbook"><para><literal>"fsync"</literal></para><para>Boolean, defaults to &false;. Forces the insert to be synced to disk before returning success. If &true;, an acknowledged insert is implied and will override setting <literal>w</literal> to <literal>0</literal>.</para></listitem>'> -<!ENTITY mongo.writes.parameters.timeout '<listitem xmlns="http://docbook.org/ns/docbook"><para><literal>"timeout"</literal></para><para>Integer, defaults to <literal>MongoCursor::$timeout</literal>. If "safe" is set, this sets how long (in milliseconds) for the client to wait for a database response. If the database does not respond within the timeout period, a <classname>MongoCursorTimeoutException</classname> will be thrown.</para></listitem>'> -<!ENTITY mongo.writes.parameters.safe '<listitem xmlns="http://docbook.org/ns/docbook"><para><literal>"safe"</literal></para><para><emphasis>Deprecated</emphasis>. Please use the <link linkend="mongo.writeconcerns">WriteConcern</link> <literal>w</literal> option.</para></listitem>'> -<!ENTITY mongo.errors.exceptions.writeconcern '<para xmlns="http://docbook.org/ns/docbook">Throws <classname>MongoCursorException</classname> if the "w" option is set and the write fails.</para><para xmlns="http://docbook.org/ns/docbook">Throws <classname>MongoCursorTimeoutException</classname> if the "w" option is set to a value greater than one and the operation takes longer than <varname>MongoCursor::$timeout</varname> milliseconds to complete. This does not kill the operation on the server, it is a client-side timeout. The operation in <literal>MongoCollection::$wtimeout</literal> is milliseconds.</para>'> + +<!ENTITY mongo.setwriteconcern.parameters '<variablelist xmlns="http://docbook.org/ns/docbook"><varlistentry><term><parameter>w</parameter></term><listitem><para>The write concern. This may be an integer denoting the number of servers required to acknowledge the write, or a string mode (e.g. "majority").</para></listitem></varlistentry><varlistentry><term><parameter>wtimeout</parameter></term><listitem><para>The maximum number of milliseconds to wait for the server to satisfy the write concern.</para></listitem></varlistentry></variablelist>'> +<!ENTITY mongo.setwriteconcern.returnvalues '<para xmlns="http://docbook.org/ns/docbook">Returns &true; on success, or &false; otherwise.</para>'> +<!ENTITY mongo.setwriteconcern.errors '<para xmlns="http://docbook.org/ns/docbook">Emits <constant>E_WARNING</constant> if the <literal>w</literal> parameter is not an integer or string value.</para>'> +<!ENTITY mongo.getwriteconcern.returnvalues '<para xmlns="http://docbook.org/ns/docbook">This function returns an array describing the write concern. The array contains the values <literal>w</literal> for an integer acknowledgement level or string mode, and <literal>wtimeout</literal> denoting the maximum number of milliseconds to wait for the server to satisfy the write concern.</para>'> +<!ENTITY mongo.command.parameters.maxtimems '<listitem xmlns="http://docbook.org/ns/docbook"><para><literal>"maxTimeMS"</literal></para><para>Specifies a cumulative time limit in milliseconds for processing the operation (does not include idle time). If the operation is not completed within the timeout period, a <classname>MongoExecutionTimeoutException</classname> will be thrown.</para></listitem>'> +<!ENTITY mongo.index.parameters.background '<listitem xmlns="http://docbook.org/ns/docbook"><para><literal>"background"</literal></para><para>Builds the index in the background so that building an index does <emphasis>not</emphasis> block other database activities. Specify &true; to build in the background. The default value is &false;.</para><warning xmlns="http://docbook.org/ns/docbook"><para>Prior to MongoDB 2.6.0, index builds on secondaries were executed as foreground operations, irrespective of this option. See <link xlink:href="&url.mongodb.dochub.indexes.rs;" xmlns:xlink="http://www.w3.org/1999/xlink">Building Indexes with Replica Sets</link> for more information.</para></warning></listitem>'> +<!ENTITY mongo.index.parameters.dropdups '<listitem xmlns="http://docbook.org/ns/docbook"><para><literal>"dropDups"</literal></para><para>Specify &true; to force creation of a unique index that may have duplicates. MongoDB will index the first occurrence of a key and delete all documents from the collection that contain subsequent occurrences of that key. The default value is &false;.</para><warning xmlns="http://docbook.org/ns/docbook"><para><literal>"dropDups"</literal> may delete data from your database. Use with extreme caution.</para></warning></listitem>'> +<!ENTITY mongo.index.parameters.expireafterseconds '<listitem xmlns="http://docbook.org/ns/docbook"><para><literal>"expireAfterSeconds"</literal></para><para>The value of this option should specify the number of seconds after which a document should be considered expired and automatically removed from the collection. This option is only compatible with single-field indexes where the field will contain <classname>MongoDate</classname> values.</para><note xmlns="http://docbook.org/ns/docbook"><para>This feature is available in MongoDB 2.2+. See <link xlink:href="&url.mongodb.docs.expire_data;" xmlns:xlink="http://www.w3.org/1999/xlink">Expire Data from Collections by Setting TTL</link> for more information.</para></note></listitem>'> +<!ENTITY mongo.index.parameters.name '<listitem xmlns="http://docbook.org/ns/docbook"><para><literal>"name"</literal></para><para>A optional name that uniquely identifies the index.</para><note xmlns="http://docbook.org/ns/docbook"><para>By default, the driver will generate an index name based on the index&apos;s field(s) and ordering or type. For example, a compound index <literal>array("x" => 1, "y" => -1)</literal> would be named <literal>"x_1_y_-1"</literal> and a geospatial index <literal>array("loc" => "2dsphere")</literal> would be named <literal>"loc_2dsphere"</literal>. For indexes with many fields, it is possible that the generated name might exceed MongoDB&apos;s <link xlink:href="&url.mongodb.docs.limits;#Index-Name-Length" xmlns:xlink="http://www.w3.org/1999/xlink">limit for index names</link>. The <literal>"name"</literal> option may be used in that case to supply a shorter name.</para></note></listitem>'> +<!ENTITY mongo.index.parameters.sparse '<listitem xmlns="http://docbook.org/ns/docbook"><para><literal>"sparse"</literal></para><para>Specify &true; to create a sparse index, which only indexes documents containing a specified field. The default value is &false;.</para></listitem>'> +<!ENTITY mongo.index.parameters.unique '<listitem xmlns="http://docbook.org/ns/docbook"><para><literal>"unique"</literal></para><para>Specify &true; to create a unique index. The default value is &false;. This option applies only to ascending/descending indexes.</para><note xmlns="http://docbook.org/ns/docbook"><para>When MongoDB indexes a field, if a document does not have a value for the field, a &null; value is indexed. If multiple documents do not contain a field, a unique index will reject all but the first of those documents. The <literal>"sparse"</literal> option may be used to overcome this, since it will prevent documents without the field from being indexed.</para></note></listitem>'> +<!ENTITY mongo.writes.parameters.writeconcern '<listitem xmlns="http://docbook.org/ns/docbook"><para><literal>"w"</literal></para><para>See <link linkend="mongo.writeconcerns">Write Concerns</link>. The default value for <classname>MongoClient</classname> is <literal>1</literal>.</para></listitem>'> +<!ENTITY mongo.writes.parameters.writeconcerntimeout '<listitem xmlns="http://docbook.org/ns/docbook"><para><literal>"wtimeout"</literal></para><para>Deprecated alias for <literal>"wTimeoutMS"</literal>.</para></listitem>'> +<!ENTITY mongo.writes.parameters.writeconcerntimeoutms '<listitem xmlns="http://docbook.org/ns/docbook"><para><literal>"wTimeoutMS"</literal></para><para>This option specifies the time limit, in milliseconds, for <link linkend="mongo.writeconcerns">write concern</link> acknowledgement. It is only applicable when <literal>"w"</literal> is greater than <literal>1</literal>, as the timeout pertains to replication. If the write concern is not satisfied within the time limit, a <classname>MongoCursorException</classname> will be thrown. A value of <literal>0</literal> may be specified to block indefinitely. The default value for <classname>MongoClient</classname> is <literal>10000</literal> (ten seconds).</para></listitem>'> +<!ENTITY mongo.writes.parameters.fsync '<listitem xmlns="http://docbook.org/ns/docbook"><para><literal>"fsync"</literal></para><para>Boolean, defaults to &false;. If journaling is enabled, it works exactly like <literal>"j"</literal>. If journaling is not enabled, the write operation blocks until it is synced to database files on disk. If &true;, an acknowledged insert is implied and this option will override setting <literal>"w"</literal> to <literal>0</literal>.</para><note><simpara>If journaling is enabled, users are strongly encouraged to use the <literal>"j"</literal> option instead of <literal>"fsync"</literal>. Do not use <literal>"fsync"</literal> and <literal>"j"</literal> simultaneously, as that will result in an error.</simpara></note></listitem>'> +<!ENTITY mongo.writes.parameters.sockettimeoutms '<listitem xmlns="http://docbook.org/ns/docbook"><para><literal>"socketTimeoutMS"</literal></para><para>This option specifies the time limit, in milliseconds, for socket communication. If the server does not respond within the timeout period, a <classname>MongoCursorTimeoutException</classname> will be thrown and there will be no way to determine if the server actually handled the write or not. A value of <literal>-1</literal> may be specified to block indefinitely. The default value for <classname>MongoClient</classname> is <literal>30000</literal> (30 seconds).</para></listitem>'> +<!ENTITY mongo.writes.parameters.journal '<listitem xmlns="http://docbook.org/ns/docbook"><para><literal>"j"</literal></para><para>Boolean, defaults to &false;. Forces the write operation to block until it is synced to the journal on disk. If &true;, an acknowledged write is implied and this option will override setting <literal>"w"</literal> to <literal>0</literal>.</para><note><simpara>If this option is used and journaling is disabled, MongoDB 2.6+ will raise an error and the write will fail; older server versions will simply ignore the option.</simpara></note></listitem>'> +<!ENTITY mongo.writes.parameters.safe '<listitem xmlns="http://docbook.org/ns/docbook"><para><literal>"safe"</literal></para><para>Deprecated. Please use the <link linkend="mongo.writeconcerns">write concern</link> <literal>"w"</literal> option.</para></listitem>'> +<!ENTITY mongo.writes.parameters.timeout '<listitem xmlns="http://docbook.org/ns/docbook"><para><literal>"timeout"</literal></para><para>Deprecated alias for <literal>"socketTimeoutMS"</literal>.</para></listitem>'> +<!ENTITY mongo.errors.exceptions.writeconcern '<para xmlns="http://docbook.org/ns/docbook">Throws <classname>MongoCursorException</classname> if the <literal>"w"</literal> option is set and the write fails.</para><para xmlns="http://docbook.org/ns/docbook">Throws <classname>MongoCursorTimeoutException</classname> if the <literal>"w"</literal> option is set to a value greater than one and the operation takes longer than <varname>MongoCursor::$timeout</varname> milliseconds to complete. This does not kill the operation on the server, it is a client-side timeout. The operation in <varname>MongoCollection::$wtimeout</varname> is milliseconds.</para>'> + <!ENTITY mongo.errors.deprecated '<para xmlns="http://docbook.org/ns/docbook">Issues <constant>E_DEPRECATED</constant> warning</para>'> <!ENTITY mongo.gridfs.store.metadata.note '<note xmlns="http://docbook.org/ns/docbook"><para>These fields may also overwrite those that would be created automatically by the driver, as described in the MongoDB core documentation for the <link xlink:href="&url.mongodb.docs.gridfs;#the-files-collection" xmlns:xlink="http://www.w3.org/1999/xlink">files collection</link>. Some practical use cases for this behavior would be to specify a custom <literal>chunkSize</literal> or <literal>_id</literal> for the file.</para></note>'> -<!ENTITY mongo.gridfs.store.return '<para xmlns="http://docbook.org/ns/docbook">Returns the <literal>_id</literal> of the saved file document. This will be a generated <classname>MongoId</classname> unless an <literal>_id</literal> was explicitly specified in the <parameter>extra</parameter> parameter.</para>'> +<!ENTITY mongo.gridfs.store.return '<para xmlns="http://docbook.org/ns/docbook">Returns the <literal>_id</literal> of the saved file document. This will be a generated <classname>MongoId</classname> unless an <literal>_id</literal> was explicitly specified in the <parameter>metadata</parameter> parameter.</para>'> +<!ENTITY mongo.mongowritebatch.writeoptions.description '<listitem xmlns="http://docbook.org/ns/docbook"><para>An array of Write Options.<informaltable><thead><row><entry>key</entry><entry>value meaning</entry></row></thead><tbody><row><entry>w (int|string)</entry><entry><link linkend="mongo.writeconcerns">Write concern</link> value</entry></row><row><entry>wtimeout (int)</entry><entry><link linkend="mongo.writeconcerns">Maximum time to wait for replication</link></entry></row><row><entry>ordered</entry><entry>Determins if MongoDB must apply this batch in order (sequentally, one item at a time) or can rearrange it. Defaults to &true;</entry></row><row><entry>j (bool)</entry><entry>Wait for journaling on the primary. This value is discouraged, use WriteConcern instead</entry></row><row><entry>fsync (bool)</entry><entry>Wait for fsync on the primary. This value is discouraged, use WriteConcern instead</entry></row></tbody></informaltable></para></listitem>'> +<!ENTITY mongo.mongowritebatch.collection.description '<listitem xmlns="http://docbook.org/ns/docbook"><para>The <classname>MongoCollection</classname> to execute the batch on. Its <link linkend="mongo.writeconcerns">write concern</link> will be copied and used as the default write concern if none is given as <parameter>$write_options</parameter> or during <methodname>MongoWriteBatch::execute</methodname>.</para></listitem>'> +<!ENTITY mongo.context.server ' <varlistentry xmlns="http://docbook.org/ns/docbook"> <term> <parameter>server</parameter> </term> <listitem> <para> An array containing the basic information about the server that was picked. <informaltable> <tgroup cols="2"> <thead> <row> <entry>key</entry> <entry>value</entry> </row> </thead> <tbody> <row> <entry>hash</entry> <entry>server hash, example: <literal>localhost:27017;-;X;56052</literal></entry> </row> <row> <entry>type</entry> <entry>Node type (primary/secondary/mongos/arbiter): <literal>2</literal></entry> </row> <row> <entry>max_bson_size</entry> <entry>The maximum BSON Size over the wire this node accepts: <literal>16777216</literal></entry> </row> <row> <entry>max_message_size</entry> <entry>The maximum Message Size over the wire this node accepts: <literal>48000000</literal></entry> </row> <row> <entry>request_id</entry> <entry>The request identifier for this message: <literal>42</literal></entry> </row> </tbody> </tgroup> ! </informaltable> </para> </listitem> </varlistentry>'> <!ENTITY mongo.context.writeoptions '<varlistentry xmlns="http://docbook.org/ns/docbook"> <term> <parameter>writeOptions</parameter> </term> <listitem> <para> <informaltable> <tgroup cols="2"> <thead> <row> <entry>key</entry> <entry>value</entry> </row> </thead> <tbody> <row> <entry>ordered</entry> <entry>boolean, if the operation (in case of batch operation) must be executed sequentually (ordered=true)</entry> </row> <row> <entry>writeConcern</entry> <entry>An array of writeConcern options (see below)</entry> </row> </tbody> </tgroup> </informaltable> <table> <title>writeConcern array values</title> <tgroup cols="2"> <thead> <row> <entry>key</entry> <entry>value</entry> </row> </thead> <tbody> <row> <entry>fsync</entry> <entry>boolean, force flushing to disk before returning</entry> </row> <row> <entry>j</entry> <entry>boolean, force journal write before returning</entry> </row> <row> <entry>wtimeout</entry> <entry>int! eger, milliseconds, maximum time the primary is allowed to wai! t to verify replication</entry> </row> <row> <entry>w</entry> <entry>integer=server count, or string=replication-tag</entry> </row> </tbody> </tgroup> </table> </para> </listitem> </varlistentry>'> <!ENTITY mongo.context.protocoloptions ' <varlistentry xmlns="http://docbook.org/ns/docbook"> <term> <parameter>protocolOptions</parameter> </term> <listitem> <para> <informaltable> <tgroup cols="2"> <thead> <row> <entry>key</entry> <entry>value</entry> </row> </thead> <tbody> <row> <entry>message_length</entry> <entry>The total size (in bytes) of the encoded message being sent over the wire</entry> </row> <row> <entry>request_id</entry> <entry>The request identifier for this message: <literal>42</literal></entry> </row> <row> <entry>namespace</entry> <entry>The MongoDB namespace used for the protocol message <literal>dbname.collectionname</literal></entry> </row> </tbody> </tgroup> </informaltable> </para> </listitem> </varlistentry>'> +<!-- Radius --> +<!ENTITY radius.request.required '<note xmlns="http://docbook.org/ns/docbook"><para>A request must be created via <function>radius_create_request</function> before this function can be called.</para></note>'> +<!ENTITY radius.parameter.attribute-type '<varlistentry xmlns="http://docbook.org/ns/docbook"><term><parameter>type</parameter></term><listitem><para>The attribute type.</para></listitem></varlistentry>'> +<!ENTITY radius.parameter.handle '<varlistentry xmlns="http://docbook.org/ns/docbook"><term><parameter>radius_handle</parameter></term><listitem><para>The RADIUS resource.</para></listitem></varlistentry>'> +<!ENTITY radius.parameter.options '<varlistentry xmlns="http://docbook.org/ns/docbook"><term><parameter>options</parameter></term><listitem><para>A bitmask of the attribute options. The available options include <link linkend="constant.radius-option-tagged"><constant>RADIUS_OPTION_TAGGED</constant></link> and <link linkend="constant.radius-option-salt"><constant>RADIUS_OPTION_SALT</constant></link>.</para></listitem></varlistentry>'> +<!ENTITY radius.parameter.tag '<varlistentry xmlns="http://docbook.org/ns/docbook"><term><parameter>tag</parameter></term><listitem><para>The attribute tag. This parameter is ignored unless the <link linkend="constant.radius-option-tagged"><constant>RADIUS_OPTION_TAGGED</constant></link> option is set.</para></listitem></varlistentry>'> +<!ENTITY radius.parameter.vendor '<varlistentry xmlns="http://docbook.org/ns/docbook"><term><parameter>vendor</parameter></term><listitem><para>The vendor ID.</para></listitem></varlistentry>'> + +<!-- posix snippets --> +<!ENTITY posix.parameter.fd '<varlistentry xmlns="http://docbook.org/ns/docbook"> + <term><parameter>fd</parameter></term> + <listitem> + <para> + The file descriptor, which is expected to be either a file + <type>resource</type> or an <type>integer</type>. An <type>integer</type> + will be assumed to be a file descriptor that can be passed directly to + the underlying system call. + </para> + <para> + In almost all cases, you will want to provide a file <type>resource</type>. + </para> + </listitem> +</varlistentry>'> + +<!-- strings snippets --> +<!ENTITY strings.parameter.encoding ' + <para xmlns="http://docbook.org/ns/docbook"> + An optional argument defining the encoding used when converting characters. + </para> + + <para xmlns="http://docbook.org/ns/docbook"> + If omitted, the default value of the <parameter>encoding</parameter> varies + depending on the PHP version in use. In PHP 5.6 and later, the + <link linkend="ini.default-charset">default_charset</link> configuration + option is used as the default value. PHP 5.4 and 5.5 will use + <literal>UTF-8</literal> as the default. Earlier versions of PHP use + <literal>ISO-8859-1</literal>. + </para> + + <para xmlns="http://docbook.org/ns/docbook"> + Although this argument is technically optional, you are highly encouraged to + specify the correct value for your code if you are using PHP 5.5 or earlier, + or if your <link linkend="ini.default-charset">default_charset</link> + configuration option may be set incorrectly for the given input. + </para> +'> + +<!ENTITY strings.changelog.encoding ' + <row xmlns="http://docbook.org/ns/docbook"> + <entry>5.6.0</entry> + <entry> + The default value for the <parameter>encoding</parameter> parameter was + changed to be the value of the + <link linkend="ini.default-charset">default_charset</link> configuration + option. + </entry> + </row> +'> + +<!-- Migration Guide snippets --> +<!ENTITY migration56.openssl.peer-verification ' + <para xmlns="http://docbook.org/ns/docbook"> + All encrypted client streams now enable peer verification by default. By + default, this will use OpenSSL&apos;s default CA bundle to verify the peer + certificate. In most cases, no changes will need to be made to communicate + with servers with valid SSL certificates, as distributors generally + configure OpenSSL to use known good CA bundles. + </para> + + <para xmlns="http://docbook.org/ns/docbook"> + The default CA bundle may be overridden on a global basis by setting + either the openssl.cafile or openssl.capath configuration setting, or on a + per request basis by using the + <link linkend="context.ssl.cafile"><parameter>cafile</parameter></link> or + <link linkend="context.ssl.capath"><parameter>capath</parameter></link> + context options. + </para> + + <para xmlns="http://docbook.org/ns/docbook"> + While not recommended in general, it is possible to disable peer + certificate verification for a request by setting the + <link linkend="context.ssl.verify-peer"><parameter>verify_peer</parameter></link> + context option to &false;, and to disable peer name validation by setting + the <link linkend="context.ssl.verify-peer-name"><parameter>verify_peer_name</parameter></link> + context option to &false;. + </para> +'> + +<!-- 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: fen fdm=syntax fdl=2 si +vim: et tw=78 +vi: ts=1 sw=1 +--> + => Put this change into your patches : https://edit.php.net/?project=php&action=putIntoMyPatches&idDB=58796 => Delete this change: https://edit.php.net/?project=php&action=deleteThisChange&idDB=58796 ------------------------------------------------------------------ Modified: zh/reference/sqlsrv/functions/sqlsrv-connect.xml By: anonymous on 2015-04-25 12:02:22 =================================================================== --- zh/reference/sqlsrv/functions/sqlsrv-connect.xml +++ zh/reference/sqlsrv/functions/sqlsrv-connect.xml @@ -0,0 +1,189 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- $Revision: 317663 $ --> +<refentry xml:id="function.sqlsrv-connect" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> + <refnamediv> + <refname>sqlsrv_connect</refname> + <refpurpose>原文:sqlsrv_connect — Opens a connection to a Microsoft SQL Server database. + 参考译文:sqlsrv_connect() —— 打开到Microsoft SQL Server数据库的连接。</refpurpose> + </refnamediv> + <refsect1 role="description"> + &reftitle.description; + <methodsynopsis> + <type>resource</type><methodname>sqlsrv_connect</methodname> + <methodparam><type>string</type><parameter>serverName</parameter></methodparam> + <methodparam choice="opt"><type>array</type><parameter>connectionInfo</parameter></methodparam> + </methodsynopsis> + <para> + 原文:Opens a connection to a Microsoft SQL Server database. By default, the connection + is attempted using Windows Authentication. To connect using SQL Server + Authentication, include "UID" and "PWD" in the connection options array. + 参考译文:打开到Microsoft SQL Server数据库的连接。默认使用Windows系统管理员身份尝试连接。 +   如果需要使用SQL Server的身份进行连接,则需要定义一个包含“UID”(MSSQL用户)和“PWD” + (MSSQL用户密码)的数组做为参数来进行连接。 + </para> + </refsect1> + + <refsect1 role="parameters"> + &reftitle.parameters; + <para> + <variablelist> + <varlistentry> + <term><parameter>serverName</parameter></term> + <listitem> + <para> + 原文:The name of the server to which a connection is established. To connect + to a specific instance, follow the server name with a forward slash + and the instance name (e.g. serverNamesqlexpress). + 参考译文:需要建立连接的MSSQL数据库。 + 连接到一个特定的实例,请使用“服务器名称实例名称”的格式(例如: serverNameSQLEXPRESS ,注意中间是以反斜杠进行连接的)。 + 个人补充:本地也可以使用(Local)进行连接,注意完整的是"(Local)"哦,包括括号。 + </para> + </listitem> + </varlistentry> + <varlistentry> + <term><parameter>connectionInfo</parameter></term> + <listitem> + <para> + 原文:An associative array that specifies options for connecting to the server. + If values for the UID and PWD keys are not specified, the connection + will be attempted using Windows Authentication. For a complete list of supported + keys, see <link xlink:href="&url.sqlsrv.connection.options;">SQLSRV Connection Options</link>. + 参考译文:存放连接数据库关联信息的数组。如果数组的键值(key)为uid和pwd的值为空的话,则将尝试使用Windows身份验证进行连接。 + 关于完整的数组键值的列表,请点击链接<link xlink:href="&url.sqlsrv.connection.options;">»sqlsrv连接选项</link>进行查阅。 + </para> + </listitem> + </varlistentry> + </variablelist> + </para> + </refsect1> + + <refsect1 role="returnvalues"> + &reftitle.returnvalues; + <para> + 原文:A connection resource. If a connection cannot be successfully opened, &false; is returned. + 参考译文:如果成功则返回一个 MSSQL 连接标识, 或者在失败时返回 FALSE。 + </para> + </refsect1> + + <refsect1 role="examples"> + &reftitle.examples; + <para> + <example> + <title>Connect using Windows Authentication.使用Windows用户身份进行连接。</title> + <programlisting role="php"> +<![CDATA[ +<?php +$serverName = "serverNamesqlexpress"; //serverNameinstanceName 数据库用户名实例名称 + +// Since UID and PWD are not specified in the $connectionInfo array, +// The connection will be attempted using Windows Authentication. +// 因为数组中没定义名为 UID 和 PWD 的键和对应的值,所以默认使用Windows用户身份进行验证并连接。 +$connectionInfo = array( "Database"=>"dbName"); +$conn = sqlsrv_connect( $serverName, $connectionInfo); + +if( $conn ) { + echo "成功创建连接。<br />"; +}else{ + echo "创建连接失败。<br />"; + die( print_r( sqlsrv_errors(), true)); +} +?> +]]> + </programlisting> + </example> + </para> + <para> + <example> + <title>Connect by specifying a user name and password.使用MSSQL用户名密码进行连接。</title> + <programlisting role="php"> +<![CDATA[ +<?php +$serverName = "serverNamesqlexpress"; //serverNameinstanceName +$connectionInfo = array( "Database"=>"dbName", "UID"=>"userName", "PWD"=>"password"); +$conn = sqlsrv_connect( $serverName, $connectionInfo); + +if( $conn ) { + echo "Connection established.<br />"; +}else{ + echo "Connection could not be established.<br />"; + die( print_r( sqlsrv_errors(), true)); +} +?> +]]> + </programlisting> + </example> + </para> + <para> + <example> + <title>Connect on a specifed port.使用指定端口进行连接。</title> + <programlisting role="php"> +<![CDATA[ +<?php +$serverName = "serverNamesqlexpress, 1542"; //serverNameinstanceName, portNumber (default is 1433) +// 默认端口号是1433,这里使用的是1542。 +$connectionInfo = array( "Database"=>"dbName", "UID"=>"userName", "PWD"=>"password"); +$conn = sqlsrv_connect( $serverName, $connectionInfo); + +if( $conn ) { + echo "Connection established.<br />"; +}else{ + echo "Connection could not be established.<br />"; + die( print_r( sqlsrv_errors(), true)); +} +?> +]]> + </programlisting> + </example> + </para> + </refsect1> + + <refsect1 role="notes"> + &reftitle.notes; + <para> + By default, the <function>sqlsrv_connect</function> uses connection pooling to + improve connection performance. To turn off connection pooling (i.e. force a + new connection on each call), set the "ConnectionPooling" option in the + $connectionOptions array to 0 (or &false;). For more information, see + <link xlink:href="&url.sqlsrv.connection.pooling;">SQLSRV Connection Pooling</link>. + </para> + <para> + The SQLSRV extension does not have a dedicated function for changing which + database is connected to. The target database is specified in the + $connectionOptions array that is passed to sqlsrv_connect. To change the + database on an open connection, execute the following query "USE dbName" + (e.g. sqlsrv_query($conn, "USE dbName")). + </para> + </refsect1> + + <refsect1 role="seealso"> + &reftitle.seealso; + <para> + <simplelist> + <member><function>sqlsrv_close</function></member> + <member><function>sqlsrv_errors</function></member> + <member><function>sqlsrv_query</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 +--> No newline at end of file => Put this change into your patches : https://edit.php.net/?project=php&action=putIntoMyPatches&idDB=62385 => Delete this change: https://edit.php.net/?project=php&action=deleteThisChange&idDB=62385 ------------------------------------------------------------------ Modified: zh/reference/yaf/appconfig.xml By: anonymous on 2016-02-20 20:06:17 =================================================================== --- zh/reference/yaf/appconfig.xml +++ zh/reference/yaf/appconfig.xml @@ -1,390 +1,390 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- $Revision: 334960 $ --> -<!-- EN-Revision: 329592 Maintainer: Carbyn Wu Status: ready --> -<!-- Reviewed: no --> - -<chapter xml:id="yaf.appconfig" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> - <title xmlns="http://docbook.org/ns/docbook">应用配置</title> - <para> - 你需要传递一个config数组或ini配置文件(参见 - <classname>Yaf_Config_Ini</classname>) 给 - <methodname>Yaf_Application::__construct</methodname>. - </para> - <para> - Yaf的配置文件会和用户的配置文件合并。区别在于,Yaf的配置文件是以"yaf."或"application."开头,如果两项都存在,则"application."生效。 - <example> - <title>config为数组的例子</title> - <programlisting role="php"> -<![CDATA[ -<?php - $configs = array( - "application" => array( - "directory" => dirname(__FILE__), - "dispatcher" => array( - "catchException" => 0, - ), - "view" => array( - "ext" => "phtml", - ), - ), - ); - $app = new Yaf_Application($config); -?> -]]> - </programlisting> - </example> - <example> - <title>config为ini文件的例子</title> - <programlisting role="ini"> -<![CDATA[ -[yaf] -yaf.directory = APPLICATION_PATH "/appliation" -yaf.dispatcher.catchException = 0 - -[product : yaf] -; user configuration list here -]]> - </programlisting> - </example> - </para> - <para> - <table> - <title>Yaf Application Config</title> - <tgroup cols="3"> - <thead> - <row> - <entry>&Name;</entry> - <entry>&Default;</entry> - <entry>&Changelog;</entry> - </row> - </thead> - <tbody> - <row> - <entry>application.directory</entry> - <entry></entry> - <entry><!-- leave empty, this will be filled by an automatic script --></entry> - </row> - <row> - <entry>application.ext</entry> - <entry>"php"</entry> - <entry><!-- leave empty, this will be filled by an automatic script --></entry> - </row> - <row> - <entry>application.view.ext</entry> - <entry>"phtml"</entry> - <entry><!-- leave empty, this will be filled by an automatic script --></entry> - </row> - <row> - <entry>application.modules</entry> - <entry>"index"</entry> - <entry><!-- leave empty, this will be filled by an automatic script --></entry> - </row> - <row> - <entry>application.library</entry> - <entry>application.directory . "/library"</entry> - <entry><!-- leave empty, this will be filled by an automatic script --></entry> - </row> - <row> - <entry>application.library.directory</entry> - <entry>application.directory . "/library"</entry> - <entry><!-- leave empty, this will be filled by an automatic script --></entry> - </row> - <row> - <entry>application.library.namespace</entry> - <entry>""</entry> - <entry><!-- leave empty, this will be filled by an automatic script --></entry> - </row> - <row> - <entry>application.bootstrap</entry> - <entry>application.directory . "/Bootstrap" . application.ext</entry> - <entry><!-- leave empty, this will be filled by an automatic script --></entry> - </row> - <row> - <entry>application.baseUri</entry> - <entry>""</entry> - <entry><!-- leave empty, this will be filled by an automatic script --></entry> - </row> - <row> - <entry>application.dispatcher.defaultRoute</entry> - <entry></entry> - <entry><!-- leave empty, this will be filled by an automatic script --></entry> - </row> - <row> - <entry>application.dispatcher.throwException</entry> - <entry>1</entry> - <entry><!-- leave empty, this will be filled by an automatic script --></entry> - </row> - <row> - <entry>application.dispatcher.catchException</entry> - <entry>0</entry> - <entry><!-- leave empty, this will be filled by an automatic script --></entry> - </row> - <row> - <entry>application.dispatcher.defaultModule</entry> - <entry>"index"</entry> - <entry><!-- leave empty, this will be filled by an automatic script --></entry> - </row> - <row> - <entry>application.dispatcher.defaultController</entry> - <entry>"index"</entry> - <entry><!-- leave empty, this will be filled by an automatic script --></entry> - </row> - <row> - <entry>application.dispatcher.defaultAction</entry> - <entry>"index"</entry> - <entry><!-- leave empty, this will be filled by an automatic script --></entry> - </row> - <row> - <entry>application.system</entry> - <entry></entry> - <entry><!-- leave empty, this will be filled by an automatic script --></entry> - </row> - </tbody> - </tgroup> - </table> - </para> - - &ini.descriptions.title; - - <para> - <variablelist> - <varlistentry xml:id="configuration.yaf.directory"> - <term> - <parameter>application.directory</parameter> - <type>string</type> - </term> - <listitem> - <para> - 应用程序的目录,包含"controllers", "views", "models", "plugins"等子目录。 - </para> - <para> - <note> - <para> - 这是唯一一个没有默认值的配置项,你需要手动指定它。 - </para> - </note> - </para> - </listitem> - </varlistentry> - <varlistentry xml:id="configuration.yaf.ext"> - <term> - <parameter>application.ext</parameter> - <type>string</type> - </term> - <listitem> - <para> - PHP脚本的扩展名,类的自动加载需要用到它( - <classname>Yaf_Loader</classname>)。 - </para> - </listitem> - </varlistentry> - <varlistentry xml:id="configuration.yaf.view.ext"> - <term> - <parameter>application.view.ext</parameter> - <type>string</type> - </term> - <listitem> - <para> - 视图模板扩展名。 - </para> - </listitem> - </varlistentry> - <varlistentry xml:id="configuration.yaf.modules"> - <term> - <parameter>application.modules</parameter> - <type>string</type> - </term> - <listitem> - <para> - 注册的模块列表,以逗号分隔,用于路由处理,特别是当PATH_INFO超过三段的时候, - </para> - <para> - Yaf需要用它来判断第一段是否是一个模块。 - </para> - </listitem> - </varlistentry> - <varlistentry xml:id="configuration.yaf.library"> - <term> - <parameter>application.library</parameter> - <type>string</type> - </term> - <listitem> - <para> - 本地类库的目录,参见<classname>Yaf_Loader</classname> 和 - <link linkend="ini.yaf.library">yaf.library</link>。 - </para> - <note> - <para> - Yaf2.1.6以后,该配置项也可以是一个数组,当它是数组的时候,类库的路径将尝试使用<link - linkend="configuration.yaf.library.directory">application.library.directory</link>的值。 - </para> - </note> - </listitem> - </varlistentry> - <varlistentry xml:id="configuration.yaf.library.directory"> - <term> - <parameter>application.library.directory</parameter> - <type>string</type> - </term> - <listitem> - <para> - Alias of <link - linkend="configuration.yaf.library">application.library</link>. Introduced - in Yaf 2.1.6 - </para> - </listitem> - </varlistentry> - <varlistentry xml:id="configuration.yaf.library.namespace"> - <term> - <parameter>application.library.namespace</parameter> - <type>string</type> - </term> - <listitem> - <para> - 逗号分隔的本地类库命名空间前缀。 - </para> - <para> - Yaf2.1.6以后加入 - </para> - </listitem> - </varlistentry> - <varlistentry xml:id="configuration.yaf.bootstrap"> - <term> - <parameter>application.bootstrap</parameter> - <type>string</type> - </term> - <listitem> - <para> - Bootstrap类脚本文件的绝对路径。 - </para> - </listitem> - </varlistentry> - <varlistentry xml:id="configuration.yaf.baseuri"> - <term> - <parameter>application.baseUri</parameter> - <type>string</type> - </term> - <listitem> - <para> - 路由处理中需要忽略的路径前缀。举个例子,请求"/prefix/controller/action"时。如果你将application.baseUri设置为"/prefix",那么只有"/controller/action"会被当做路由路径。 - </para> - <para> - 通常不需要设置此值。 - </para> - </listitem> - </varlistentry> - <varlistentry xml:id="configuration.yaf.dispatcher.throwexception"> - <term> - <parameter>application.dispatcher.throwException</parameter> - <type>bool</type> - </term> - <listitem> - <para> - 开启此项,Yaf会在发生错误的地方抛出异常。参见 - <methodname>Yaf_Dispatcher::throwException</methodname>。 - </para> - </listitem> - </varlistentry> - <varlistentry xml:id="configuration.yaf.dispatcher.catchexception"> - <term> - <parameter>application.dispatcher.catchException</parameter> - <type>bool</type> - </term> - <listitem> - <para> - 开启此项,如果有未捕获的异常,Yaf将会把它定向到Error controller, Error Action。参见 - <methodname>Yaf_Dispatcher::catchException</methodname>。 - </para> - </listitem> - </varlistentry> - <varlistentry xml:id="configuration.yaf.dispatcher.defaulRoute"> - <term> - <parameter>application.dispatcher.defaultRoute</parameter> - <type>string</type> - </term> - <listitem> - <para> - 默认路由,如果未指定,静态路由会被当做是默认路由,参见: - <methodname>Yaf_Router::addRoute</methodname>。 - </para> - </listitem> - </varlistentry> - <varlistentry xml:id="configuration.yaf.dispatcher.defaultmodule"> - <term> - <parameter>application.dispatcher.defaultModule</parameter> - <type>string</type> - </term> - <listitem> - <para> - 默认模块名,参见 - <methodname>Yaf_Dispatcher::setDefaultModule</methodname>。 - </para> - </listitem> - </varlistentry> - <varlistentry xml:id="configuration.yaf.dispatcher.defaultcontroller"> - <term> - <parameter>application.dispatcher.defaultController</parameter> - <type>string</type> - </term> - <listitem> - <para> - 默认控制器名,参见 - <methodname>Yaf_Dispatcher::setDefaultController</methodname>。 - </para> - </listitem> - </varlistentry> - <varlistentry xml:id="configuration.yaf.dispatcher.defaultaction"> - <term> - <parameter>application.dispatcher.defaultAction</parameter> - <type>string</type> - </term> - <listitem> - <para> - 默认动作名,参见 - <methodname>Yaf_Dispatcher::setDefaultAction</methodname>。 - </para> - </listitem> - </varlistentry> - - <varlistentry xml:id="configuration.yaf.system"> - <term> - <parameter>application.system</parameter> - <type>string</type> - </term> - <listitem> - <para> - 在application.ini中设置Yaf运行时配置,如: - <link linkend="ini.yaf.lowcase-path">application.system.lowcase_path</link> - <note> - <para> - 仅有PHP_INI_ALL配置项能这样设置 - </para> - </note> - </para> - </listitem> - </varlistentry> - - </variablelist> - </para> -</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 ---> +<?xml version="1.0" encoding="utf-8"?> +<!-- $Revision: 334960 $ --> +<!-- EN-Revision: 329592 Maintainer: Carbyn Wu Status: ready --> +<!-- Reviewed: no --> + +<chapter xml:id="yaf.appconfig" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> + <title xmlns="http://docbook.org/ns/docbook">应用配置</title> + <para> + 你需要传递一个config数组或ini配置文件(参见 + <classname>Yaf_Config_Ini</classname>) 给 + <methodname>Yaf_Application::__construct</methodname>. + </para> + <para> + Yaf的配置文件会和用户的配置文件合并。区别在于,Yaf的配置文件是以"yaf."或"application."开头,如果两项都存在,则"application."生效。 + <example> + <title>config为数组的例子</title> + <programlisting role="php"> +<![CDATA[ +<?php + $configs = array( + "application" => array( + "directory" => dirname(__FILE__), + "dispatcher" => array( + "catchException" => 0, + ), + "view" => array( + "ext" => "phtml", + ), + ), + ); + $app = new Yaf_Application($config); +?> +]]> + </programlisting> + </example> + <example> + <title>config为ini文件的例子</title> + <programlisting role="ini"> +<![CDATA[ +[yaf] +yaf.directory = APPLICATION_PATH "/appliation" +yaf.dispatcher.catchException = 0 + +[product : yaf] +; user configuration list here +]]> + </programlisting> + </example> + </para> + <para> + <table> + <title>Yaf Application Config</title> + <tgroup cols="3"> + <thead> + <row> + <entry>&Name;</entry> + <entry>&Default;</entry> + <entry>&Changelog;</entry> + </row> + </thead> + <tbody> + <row> + <entry>application.directory</entry> + <entry></entry> + <entry><!-- leave empty, this will be filled by an automatic script --></entry> + </row> + <row> + <entry>application.ext</entry> + <entry>"php"</entry> + <entry><!-- leave empty, this will be filled by an automatic script --></entry> + </row> + <row> + <entry>application.view.ext</entry> + <entry>"phtml"</entry> + <entry><!-- leave empty, this will be filled by an automatic script --></entry> + </row> + <row> + <entry>application.modules</entry> + <entry>"index"</entry> + <entry><!-- leave empty, this will be filled by an automatic script --></entry> + </row> + <row> + <entry>application.library</entry> + <entry>application.directory . "/library"</entry> + <entry><!-- leave empty, this will be filled by an automatic script --></entry> + </row> + <row> + <entry>application.library.directory</entry> + <entry>application.directory . "/library"</entry> + <entry><!-- leave empty, this will be filled by an automatic script --></entry> + </row> + <row> + <entry>application.library.namespace</entry> + <entry>""</entry> + <entry><!-- leave empty, this will be filled by an automatic script --></entry> + </row> + <row> + <entry>application.bootstrap</entry> + <entry>application.directory . "/Bootstrap" . application.ext</entry> + <entry><!-- leave empty, this will be filled by an automatic script --></entry> + </row> + <row> + <entry>application.baseUri</entry> + <entry>""</entry> + <entry><!-- leave empty, this will be filled by an automatic script --></entry> + </row> + <row> + <entry>application.dispatcher.defaultRoute</entry> + <entry></entry> + <entry><!-- leave empty, this will be filled by an automatic script --></entry> + </row> + <row> + <entry>application.dispatcher.throwException</entry> + <entry>1</entry> + <entry><!-- leave empty, this will be filled by an automatic script --></entry> + </row> + <row> + <entry>application.dispatcher.catchException</entry> + <entry>0</entry> + <entry><!-- leave empty, this will be filled by an automatic script --></entry> + </row> + <row> + <entry>application.dispatcher.defaultModule</entry> + <entry>"index"</entry> + <entry><!-- leave empty, this will be filled by an automatic script --></entry> + </row> + <row> + <entry>application.dispatcher.defaultController</entry> + <entry>"index"</entry> + <entry><!-- leave empty, this will be filled by an automatic script --></entry> + </row> + <row> + <entry>application.dispatcher.defaultAction</entry> + <entry>"index"</entry> + <entry><!-- leave empty, this will be filled by an automatic script --></entry> + </row> + <row> + <entry>application.system</entry> + <entry></entry> + <entry><!-- leave empty, this will be filled by an automatic script --></entry> + </row> + </tbody> + </tgroup> + </table> + </para> + + &ini.descriptions.title; + + <para> + <variablelist> + <varlistentry xml:id="configuration.yaf.directory"> + <term> + <parameter>application.directory</parameter> + <type>string</type> + </term> + <listitem> + <para> + 应用程序的目录,包含"controllers", "views", "models", "plugins"等子目录。 + </para> + <para> + <note> + <para> + 这是唯一一个没有默认值的配置项,你需要手动指定它。 + </para> + </note> + </para> + </listitem> + </varlistentry> + <varlistentry xml:id="configuration.yaf.ext"> + <term> + <parameter>application.ext</parameter> + <type>string</type> + </term> + <listitem> + <para> + PHP脚本的扩展名,类的自动加载需要用到它( + <classname>Yaf_Loader</classname>)。 + </para> + </listitem> + </varlistentry> + <varlistentry xml:id="configuration.yaf.view.ext"> + <term> + <parameter>application.view.ext</parameter> + <type>string</type> + </term> + <listitem> + <para> + 视图模板扩展名。 + </para> + </listitem> + </varlistentry> + <varlistentry xml:id="configuration.yaf.modules"> + <term> + <parameter>application.modules</parameter> + <type>string</type> + </term> + <listitem> + <para> + 注册的模块列表,以逗号分隔(在模块名称之间有且仅能是以一个逗号分隔,否则除开头的Index模块能够加载外,后续模块加载不了),用于路由处理,特别是当PATH_INFO超过三段的时候, + </para> + <para> + Yaf需要用它来判断第一段是否是一个模块。 + </para> + </listitem> + </varlistentry> + <varlistentry xml:id="configuration.yaf.library"> + <term> + <parameter>application.library</parameter> + <type>string</type> + </term> + <listitem> + <para> + 本地类库的目录,参见<classname>Yaf_Loader</classname> 和 + <link linkend="ini.yaf.library">yaf.library</link>。 + </para> + <note> + <para> + Yaf2.1.6以后,该配置项也可以是一个数组,当它是数组的时候,类库的路径将尝试使用<link + linkend="configuration.yaf.library.directory">application.library.directory</link>的值。 + </para> + </note> + </listitem> + </varlistentry> + <varlistentry xml:id="configuration.yaf.library.directory"> + <term> + <parameter>application.library.directory</parameter> + <type>string</type> + </term> + <listitem> + <para> + Alias of <link + linkend="configuration.yaf.library">application.library</link>. Introduced + in Yaf 2.1.6 + </para> + </listitem> + </varlistentry> + <varlistentry xml:id="configuration.yaf.library.namespace"> + <term> + <parameter>application.library.namespace</parameter> + <type>string</type> + </term> + <listitem> + <para> + 逗号分隔的本地类库命名空间前缀。 + </para> + <para> + Yaf2.1.6以后加入 + </para> + </listitem> + </varlistentry> + <varlistentry xml:id="configuration.yaf.bootstrap"> + <term> + <parameter>application.bootstrap</parameter> + <type>string</type> + </term> + <listitem> + <para> + Bootstrap类脚本文件的绝对路径。 + </para> + </listitem> + </varlistentry> + <varlistentry xml:id="configuration.yaf.baseuri"> + <term> + <parameter>application.baseUri</parameter> + <type>string</type> + </term> + <listitem> + <para> + 路由处理中需要忽略的路径前缀。举个例子,请求"/prefix/controller/action"时。如果你将application.baseUri设置为"/prefix",那么只有"/controller/action"会被当做路由路径。 + </para> + <para> + 通常不需要设置此值。 + </para> + </listitem> + </varlistentry> + <varlistentry xml:id="configuration.yaf.dispatcher.throwexception"> + <term> + <parameter>application.dispatcher.throwException</parameter> + <type>bool</type> + </term> + <listitem> + <para> + 开启此项,Yaf会在发生错误的地方抛出异常。参见 + <methodname>Yaf_Dispatcher::throwException</methodname>。 + </para> + </listitem> + </varlistentry> + <varlistentry xml:id="configuration.yaf.dispatcher.catchexception"> + <term> + <parameter>application.dispatcher.catchException</parameter> + <type>bool</type> + </term> + <listitem> + <para> + 开启此项,如果有未捕获的异常,Yaf将会把它定向到Error controller, Error Action。参见 + <methodname>Yaf_Dispatcher::catchException</methodname>。 + </para> + </listitem> + </varlistentry> + <varlistentry xml:id="configuration.yaf.dispatcher.defaulRoute"> + <term> + <parameter>application.dispatcher.defaultRoute</parameter> + <type>string</type> + </term> + <listitem> + <para> + 默认路由,如果未指定,静态路由会被当做是默认路由,参见: + <methodname>Yaf_Router::addRoute</methodname>。 + </para> + </listitem> + </varlistentry> + <varlistentry xml:id="configuration.yaf.dispatcher.defaultmodule"> + <term> + <parameter>application.dispatcher.defaultModule</parameter> + <type>string</type> + </term> + <listitem> + <para> + 默认模块名,参见 + <methodname>Yaf_Dispatcher::setDefaultModule</methodname>。 + </para> + </listitem> + </varlistentry> + <varlistentry xml:id="configuration.yaf.dispatcher.defaultcontroller"> + <term> + <parameter>application.dispatcher.defaultController</parameter> + <type>string</type> + </term> + <listitem> + <para> + 默认控制器名,参见 + <methodname>Yaf_Dispatcher::setDefaultController</methodname>。 + </para> + </listitem> + </varlistentry> + <varlistentry xml:id="configuration.yaf.dispatcher.defaultaction"> + <term> + <parameter>application.dispatcher.defaultAction</parameter> + <type>string</type> + </term> + <listitem> + <para> + 默认动作名,参见 + <methodname>Yaf_Dispatcher::setDefaultAction</methodname>。 + </para> + </listitem> + </varlistentry> + + <varlistentry xml:id="configuration.yaf.system"> + <term> + <parameter>application.system</parameter> + <type>string</type> + </term> + <listitem> + <para> + 在application.ini中设置Yaf运行时配置,如: + <link linkend="ini.yaf.lowcase-path">application.system.lowcase_path</link> + <note> + <para> + 仅有PHP_INI_ALL配置项能这样设置 + </para> + </note> + </para> + </listitem> + </varlistentry> + + </variablelist> + </para> +</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 +--> => Put this change into your patches : https://edit.php.net/?project=php&action=putIntoMyPatches&idDB=66269 => Delete this change: https://edit.php.net/?project=php&action=deleteThisChange&idDB=66269 ------------------------------------------------------------------ Modified: zh/reference/yaf/yaf-loader.xml By: 张明 on 2016-04-19 00:45:17 =================================================================== --- zh/reference/yaf/yaf-loader.xml +++ zh/reference/yaf/yaf-loader.xml @@ -1,271 +1,271 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- $Revision: 334960 $ --> - -<phpdoc:classref xml:id="class.yaf-loader" xmlns:phpdoc="http://php.net/ns/phpdoc" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude"> - - <title>The Yaf_Loader class</title> - <titleabbrev>Yaf_Loader</titleabbrev> - - <partintro> - -<!-- {{{ Yaf_Loader intro --> - <section xml:id="yaf-loader.intro"> - &reftitle.intro; - <para> - <classname>Yaf_Loader</classname> 类为Yaf提供了自动加载功能的全面解决方案。 - </para> - <para> - 在第一次使用的时候,将检索 <classname>Yaf_Application</classname> 的实例, - <classname>Yaf_Loader</classname> 实现了单利模式,并使用spl_autoload注册它自己。 - 通过 <methodname>Yaf_Loader::getInstance</methodname> 返回它的实例 - </para> - <para> - <classname>Yaf_Loader</classname> 加载一个类时仅仅尝试一次,如果失败了, - 后面的操作将取决于<link linkend="ini.yaf.use-spl-autoload">yaf.use_spl_auload</link>, - 如果这个配置项为On,<methodname>Yaf_Loader::autoload</methodname> 将会返回FALSE, - 从而把机会让给其他的自动加载功能。如果这个配置项为Off(默认), - <methodname>Yaf_Loader::autoload</methodname> 将会返回TRUE, - 最重要的是将会抛出一个非常有用的警告(对于找出一个类加载失败非常有用)。 - <note> - <para> - 请保持yaf.use_spl_autoload保持关闭,除非有一些library有自己的autoload机制,并且是无法改写的。 - </para> - </note> - </para> - <para> - 默认情况下,<classname>Yaf_Loader</classname> 收集所有library(类定义的脚本)储存进在 - php.ini(yaf.library)定义的<link linkend="ini.yaf.library">global library directory</link>之中。 - </para> - - <para> - 如果你想使用 <classname>Yaf_Loader</classname> 搜索本地类(库)(定义在application.ini, - 默认情况下,它是 <link linkend="configuration.yaf.directory">application.directory</link> . "/libraray"), - 你需要使用 <methodname>Yaf_Loader::registerLocalNameSpace</methodname> 注册本地类前缀。 - </para> - - <para> - 让我们来看看一些例子(假设 APPLICATION_PATH 是 <link linkend="configuration.yaf.directory">application.directory</link>): - <example> - <title>Config example</title> - <programlisting role="shell"> -<![CDATA[ -// Assuming the following configure in php.ini: -yaf.libraray = "/global_dir" - -//Assuming the following configure in application.ini -application.libraray = APPLICATION_PATH "/library" -]]> - </programlisting> - </example> - 假设以下本地名称空间已被注册: - <example> - <title>注册本地命名空间</title> - <programlisting role="php"> -<![CDATA[ -<?php -class Bootstrap extends Yaf_Bootstrap_Abstract{ - public function _initLoader($dispatcher) { - Yaf_Loader::getInstance()->registerLocalNameSpace(array("Foo", "Bar")); - } -?> -]]> - </programlisting> - </example> - 自动加载例子: - <example> - <title>加载类</title> - <programlisting role="shell"> -<![CDATA[ -class Foo_Bar_Test => - // APPLICATION_PATH/library/Foo/Bar/Test.php - -class GLO_Name => - // /global_dir/Glo/Name.php - -class BarNon_Test - // /global_dir/Barnon/Test.php -]]> - </programlisting> - </example> - 在PHP 5.3中,你可以使用命名空间: - <example> - <title>加载命名空间类</title> - <programlisting role="shell"> -<![CDATA[ -class FooBarDummy => - // APPLICATION_PATH/library/Foo/Bar/Dummy.php - -class FooBarBarDummy => - // /global_dir/FooBar/Bar/Dummy.php -]]> - </programlisting> - </example> - </para> - - <para> - 你可能会注意到所有文件夹名字的首字母是大写的,你可以通过在php.ini中设置 <link linkend="ini.yaf.lowcase-path">yaf.lowcase_path</link> = On 来将它们小写。 - </para> - - <para> - <classname>Yaf_Loader</classname> 也是设计来加载MVC类,响应的规则如下: - <example> - <title>MVC类加载例子</title> - <programlisting role="shell"> -<![CDATA[ -Controller Classes => -// APPLICATION_PATH/controllers/ - -Model Classes => -// APPLICATION_PATH/models/ - -Plugin Classes => -// APPLICATION_PATH/plugins/ -]]> - </programlisting> - </example> - Yaf 通过识别一个类的后缀(这个是默认的,你也可以通过改变配置项 <link - linkend="ini.yaf.name-suffix">yaf.name_suffix</link> 来将它改为通过前缀识别)来决定它是否是一个MVC类: - <example> - <title>MVC 类区别</title> - <programlisting role="shell"> -<![CDATA[ -Controller Classes => - // ***Controller - -Model Classes => - // ***Model - -Plugin Classes => - // ***Plugin -]]> - </programlisting> - </example> - - some examples: - <example> - <title>MVC loading example</title> - <programlisting role="shell"> -<![CDATA[ -class IndexController - // APPLICATION_PATH/controllers/Index.php - -class DataModel => - // APPLICATION_PATH/models/Data.php - -class DummyPlugin => - // APPLICATION_PATH/plugins/Dummy.php - -class A_B_TestModel => - // APPLICATION_PATH/models/A/B/Test.php -]]> - </programlisting> - </example> - 该目录将受 <link linkend="ini.yaf.lowcase-path">yaf.lowcase_path</link> 的影响。 - </para> - </section> -<!-- }}} --> - - <section xml:id="yaf-loader.synopsis"> - &reftitle.classsynopsis; - -<!-- {{{ Synopsis --> - <classsynopsis> - <ooclass><classname>Yaf_Loader</classname></ooclass> - -<!-- {{{ Class synopsis --> - <classsynopsisinfo> - <ooclass> - <classname>Yaf_Loader</classname> - </ooclass> - </classsynopsisinfo> -<!-- }}} --> - <classsynopsisinfo role="comment">&Properties;</classsynopsisinfo> - <fieldsynopsis> - <modifier>protected</modifier> - <varname linkend="yaf-loader.props.local-ns">_local_ns</varname> - </fieldsynopsis> - <fieldsynopsis> - <modifier>protected</modifier> - <varname linkend="yaf-loader.props.library">_library</varname> - </fieldsynopsis> - <fieldsynopsis> - <modifier>protected</modifier> - <varname linkend="yaf-loader.props.global-library">_global_library</varname> - </fieldsynopsis> - <fieldsynopsis> - <modifier>static</modifier> - <varname linkend="yaf-loader.props.instance">_instance</varname> - </fieldsynopsis> - - - <classsynopsisinfo role="comment">&Methods;</classsynopsisinfo> - <xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.yaf-loader')/db:refentry/db:refsect1[@role='description']/descendant::db:methodsynopsis[1])" /> - </classsynopsis> -<!-- }}} --> - - </section> - - -<!-- {{{ Yaf_Loader properties --> - <section xml:id="yaf-loader.props"> - &reftitle.properties; - <variablelist> - <varlistentry xml:id="yaf-loader.props.local-ns"> - <term><varname>_local_ns</varname></term> - <listitem> - <para></para> - </listitem> - </varlistentry> - <varlistentry xml:id="yaf-loader.props.library"> - <term><varname>_library</varname></term> - <listitem> - <para> - 默认情况下,它的值是 <link linkend="configuration.yaf.directory">application.directory</link> . "/library", - 你可以通过修改application.ini(application.library)或者调用 <methodname>Yaf_Loader::setLibraryPath</methodname> 改变它。 - </para> - </listitem> - </varlistentry> - <varlistentry xml:id="yaf-loader.props.global-library"> - <term><varname>_global_library</varname></term> - <listitem> - <para></para> - </listitem> - </varlistentry> - <varlistentry xml:id="yaf-loader.props.instance"> - <term><varname>_instance</varname></term> - <listitem> - <para></para> - </listitem> - </varlistentry> - </variablelist> - </section> -<!-- }}} --> - - - </partintro> - - - &reference.yaf.entities.yaf-loader; - -</phpdoc:classref> - -<!-- 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 ---> +<?xml version="1.0" encoding="utf-8"?> +<!-- $Revision: 334960 $ --> + +<phpdoc:classref xml:id="class.yaf-loader" xmlns:phpdoc="http://php.net/ns/phpdoc" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude"> + + <title>The Yaf_Loader class</title> + <titleabbrev>Yaf_Loader</titleabbrev> + + <partintro> + +<!-- {{{ Yaf_Loader intro --> + <section xml:id="yaf-loader.intro"> + &reftitle.intro; + <para> + <classname>Yaf_Loader</classname> 类为Yaf提供了自动加载功能的全面解决方案。 + </para> + <para> + 在第一次使用的时候,将检索 <classname>Yaf_Application</classname> 的实例, + <classname>Yaf_Loader</classname> 实现了单例模式,并使用spl_autoload注册它自己。 + 通过 <methodname>Yaf_Loader::getInstance</methodname> 返回它的实例 + </para> + <para> + <classname>Yaf_Loader</classname> 加载一个类时仅仅尝试一次,如果失败了, + 后面的操作将取决于<link linkend="ini.yaf.use-spl-autoload">yaf.use_spl_auload</link>, + 如果这个配置项为On,<methodname>Yaf_Loader::autoload</methodname> 将会返回FALSE, + 从而把机会让给其他的自动加载功能。如果这个配置项为Off(默认), + <methodname>Yaf_Loader::autoload</methodname> 将会返回TRUE, + 最重要的是将会抛出一个非常有用的警告(对于找出一个类加载失败非常有用)。 + <note> + <para> + 请保持yaf.use_spl_autoload保持关闭,除非有一些library有自己的autoload机制,并且是无法改写的。 + </para> + </note> + </para> + <para> + 默认情况下,<classname>Yaf_Loader</classname> 收集所有library(类定义的脚本)储存进在 + php.ini(yaf.library)定义的<link linkend="ini.yaf.library">global library directory</link>之中。 + </para> + + <para> + 如果你想使用 <classname>Yaf_Loader</classname> 搜索本地类(库)(定义在application.ini, + 默认情况下,它是 <link linkend="configuration.yaf.directory">application.directory</link> . "/libraray"), + 你需要使用 <methodname>Yaf_Loader::registerLocalNameSpace</methodname> 注册本地类前缀。 + </para> + + <para> + 让我们来看看一些例子(假设 APPLICATION_PATH 是 <link linkend="configuration.yaf.directory">application.directory</link>): + <example> + <title>Config example</title> + <programlisting role="shell"> +<![CDATA[ +// Assuming the following configure in php.ini: +yaf.libraray = "/global_dir" + +//Assuming the following configure in application.ini +application.libraray = APPLICATION_PATH "/library" +]]> + </programlisting> + </example> + 假设以下本地名称空间已被注册: + <example> + <title>注册本地命名空间</title> + <programlisting role="php"> +<![CDATA[ +<?php +class Bootstrap extends Yaf_Bootstrap_Abstract{ + public function _initLoader($dispatcher) { + Yaf_Loader::getInstance()->registerLocalNameSpace(array("Foo", "Bar")); + } +?> +]]> + </programlisting> + </example> + 自动加载例子: + <example> + <title>加载类</title> + <programlisting role="shell"> +<![CDATA[ +class Foo_Bar_Test => + // APPLICATION_PATH/library/Foo/Bar/Test.php + +class GLO_Name => + // /global_dir/Glo/Name.php + +class BarNon_Test + // /global_dir/Barnon/Test.php +]]> + </programlisting> + </example> + 在PHP 5.3中,你可以使用命名空间: + <example> + <title>加载命名空间类</title> + <programlisting role="shell"> +<![CDATA[ +class FooBarDummy => + // APPLICATION_PATH/library/Foo/Bar/Dummy.php + +class FooBarBarDummy => + // /global_dir/FooBar/Bar/Dummy.php +]]> + </programlisting> + </example> + </para> + + <para> + 你可能会注意到所有文件夹名字的首字母是大写的,你可以通过在php.ini中设置 <link linkend="ini.yaf.lowcase-path">yaf.lowcase_path</link> = On 来将它们小写。 + </para> + + <para> + <classname>Yaf_Loader</classname> 也是设计来加载MVC类,响应的规则如下: + <example> + <title>MVC类加载例子</title> + <programlisting role="shell"> +<![CDATA[ +Controller Classes => +// APPLICATION_PATH/controllers/ + +Model Classes => +// APPLICATION_PATH/models/ + +Plugin Classes => +// APPLICATION_PATH/plugins/ +]]> + </programlisting> + </example> + Yaf 通过识别一个类的后缀(这个是默认的,你也可以通过改变配置项 <link + linkend="ini.yaf.name-suffix">yaf.name_suffix</link> 来将它改为通过前缀识别)来决定它是否是一个MVC类: + <example> + <title>MVC 类区别</title> + <programlisting role="shell"> +<![CDATA[ +Controller Classes => + // ***Controller + +Model Classes => + // ***Model + +Plugin Classes => + // ***Plugin +]]> + </programlisting> + </example> + + some examples: + <example> + <title>MVC loading example</title> + <programlisting role="shell"> +<![CDATA[ +class IndexController + // APPLICATION_PATH/controllers/Index.php + +class DataModel => + // APPLICATION_PATH/models/Data.php + +class DummyPlugin => + // APPLICATION_PATH/plugins/Dummy.php + +class A_B_TestModel => + // APPLICATION_PATH/models/A/B/Test.php +]]> + </programlisting> + </example> + 该目录将受 <link linkend="ini.yaf.lowcase-path">yaf.lowcase_path</link> 的影响。 + </para> + </section> +<!-- }}} --> + + <section xml:id="yaf-loader.synopsis"> + &reftitle.classsynopsis; + +<!-- {{{ Synopsis --> + <classsynopsis> + <ooclass><classname>Yaf_Loader</classname></ooclass> + +<!-- {{{ Class synopsis --> + <classsynopsisinfo> + <ooclass> + <classname>Yaf_Loader</classname> + </ooclass> + </classsynopsisinfo> +<!-- }}} --> + <classsynopsisinfo role="comment">&Properties;</classsynopsisinfo> + <fieldsynopsis> + <modifier>protected</modifier> + <varname linkend="yaf-loader.props.local-ns">_local_ns</varname> + </fieldsynopsis> + <fieldsynopsis> + <modifier>protected</modifier> + <varname linkend="yaf-loader.props.library">_library</varname> + </fieldsynopsis> + <fieldsynopsis> + <modifier>protected</modifier> + <varname linkend="yaf-loader.props.global-library">_global_library</varname> + </fieldsynopsis> + <fieldsynopsis> + <modifier>static</modifier> + <varname linkend="yaf-loader.props.instance">_instance</varname> + </fieldsynopsis> + + + <classsynopsisinfo role="comment">&Methods;</classsynopsisinfo> + <xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.yaf-loader')/db:refentry/db:refsect1[@role='description']/descendant::db:methodsynopsis[1])" /> + </classsynopsis> +<!-- }}} --> + + </section> + + +<!-- {{{ Yaf_Loader properties --> + <section xml:id="yaf-loader.props"> + &reftitle.properties; + <variablelist> + <varlistentry xml:id="yaf-loader.props.local-ns"> + <term><varname>_local_ns</varname></term> + <listitem> + <para></para> + </listitem> + </varlistentry> + <varlistentry xml:id="yaf-loader.props.library"> + <term><varname>_library</varname></term> + <listitem> + <para> + 默认情况下,它的值是 <link linkend="configuration.yaf.directory">application.directory</link> . "/library", + 你可以通过修改application.ini(application.library)或者调用 <methodname>Yaf_Loader::setLibraryPath</methodname> 改变它。 + </para> + </listitem> + </varlistentry> + <varlistentry xml:id="yaf-loader.props.global-library"> + <term><varname>_global_library</varname></term> + <listitem> + <para></para> + </listitem> + </varlistentry> + <varlistentry xml:id="yaf-loader.props.instance"> + <term><varname>_instance</varname></term> + <listitem> + <para></para> + </listitem> + </varlistentry> + </variablelist> + </section> +<!-- }}} --> + + + </partintro> + + + &reference.yaf.entities.yaf-loader; + +</phpdoc:classref> + +<!-- 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 +--> => Put this change into your patches : https://edit.php.net/?project=php&action=putIntoMyPatches&idDB=66987 => Delete this change: https://edit.php.net/?project=php&action=deleteThisChange&idDB=66987 ------------------------------------------------------------------ Modified: zh/reference/curl/functions/curl-setopt.xml By: AnnAngela on 2016-04-19 06:25:24 =================================================================== --- zh/reference/curl/functions/curl-setopt.xml +++ zh/reference/curl/functions/curl-setopt.xml @@ -65,9 +65,9 @@ 设为 &true; ,将在启用 <constant>CURLOPT_RETURNTRANSFER</constant> 时,返回原生的(Raw)输出。 </entry> <entry valign="top"> - From PHP 5.1.3, this option has no effect: the raw output will - always be returned when - <constant>CURLOPT_RETURNTRANSFER</constant> is used. + 从PHP 5.1.3开始,此选项将不起作用:当 + <constant>CURLOPT_RETURNTRANSFER</constant> + 被设置为&true; 时,输出内容永远为源内容 </entry> </row> <row> => Put this change into your patches : https://edit.php.net/?project=php&action=putIntoMyPatches&idDB=66989 => Delete this change: https://edit.php.net/?project=php&action=deleteThisChange&idDB=66989 ------------------------------------------------------------------ Modified: zh/language/errors/php7.xml By: Fish Drowned on 2016-04-23 09:06:23 =================================================================== --- zh/language/errors/php7.xml +++ zh/language/errors/php7.xml @@ -1,35 +1,35 @@ <?xml version="1.0" encoding="utf-8"?> <!-- $Revision: 338637 $ --> -<!-- EN-Revision: 337376 Maintainer: FishDrowned Status: ready --> +<!-- EN-Revision: 338227 Maintainer: FishDrowned Status: ready --> <!-- Reviewed: no --> <sect1 xml:id="language.errors.php7" xmlns="http://docbook.org/ns/docbook"> <title>PHP 7 错误处理</title> <para> - PHP 7 改变了大多数错误的报告方式。不同于 PHP 5 的传统错误报告机制,现在大多数错误 - 被作为 <classname>Error</classname> 异常抛出。 + PHP 7 改变了大多数错误的报告方式。不同于传统(PHP 5)的错误报告机制,现在大多数错误被作为 + <classname>Error</classname> 异常抛出。 </para> <para> - 这种 <classname>Error</classname> 异常可以像普通异常一样被 - <literal>try</literal> / <literal>catch</literal> - 块所捕获。如果没有匹配的 <literal>try</literal> / <literal>catch</literal> 块, - 则调用异常处理函数(由 <function>set_exception_handler</function> 注册)进行处理。 + 这种 <classname>Error</classname> 异常可以像 <classname>Exception</classname> + 异常一样被第一个匹配的 <literal>try</literal> / <literal>catch</literal> + 块所捕获。如果没有匹配的 + <link linkend="language.exceptions.catch"><literal>catch</literal></link> + 块,则调用异常处理函数(事先通过 <function>set_exception_handler</function> 注册)进行处理。 如果尚未注册异常处理函数,则按照传统方式处理:被报告为一个致命错误(Fatal Error)。 </para> <para> - <classname>Error</classname> 类并不是从 <classname>Exception</classname> 类 - 扩展出来的,所以用 <code>catch (Exception $e) { ... }</code> 这样的代码是捕获不 - 到 <classname>Error</classname> 的。你可以用 - <code>catch (Error $e) { ... }</code> 这样的代码,或者通过注册异常处理函数( - <function>set_exception_handler</function>)来捕获 - <classname>Error</classname>。 + <classname>Error</classname> 类并非继承自 <classname>Exception</classname> + 类,所以不能用 <code>catch (Exception $e) { ... }</code> 来捕获 + <classname>Error</classname>。你可以用 + <code>catch (Error $e) { ... }</code>,或者通过注册异常处理函数( + <function>set_exception_handler</function>)来捕获 <classname>Error</classname>。 </para> <sect2 xml:id="language.errors.php7.hierarchy"> - <title><classname>Error</classname> 异常层次结构</title> + <title><classname>Error</classname> 层次结构</title> <itemizedlist> <listitem> @@ -40,14 +40,16 @@ <itemizedlist> <listitem> <simpara><classname>ArithmeticError</classname></simpara> + <itemizedlist> + <listitem> + <simpara><classname>DivisionByZeroError</classname></simpara> + </listitem> + </itemizedlist> </listitem> <listitem> <simpara><classname>AssertionError</classname></simpara> </listitem> <listitem> - <simpara><classname>DivisionByZeroError</classname></simpara> - </listitem> - <listitem> <simpara><classname>ParseError</classname></simpara> </listitem> <listitem> => Put this change into your patches : https://edit.php.net/?project=php&action=putIntoMyPatches&idDB=67023 => Delete this change: https://edit.php.net/?project=php&action=deleteThisChange&idDB=67023 ------------------------------------------------------------------ -- https://edit.php.net/ This email is send automatically by the Php Docbook Online Editor.

« previous php.doc.zh (#4658) next »