1
0
mirror of https://github.com/php/doc-zh.git synced 2026-04-26 01:28:18 +02:00
Files
2025-11-02 22:06:14 +08:00

114 lines
3.2 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<!-- EN-Revision: 3a8c3e77df070a046c9d5b56b68926ca2d7e5ee3 Maintainer: duanxiaoqiang Status: ready -->
<!-- CREDITS: mowangjuanzi -->
<refentry xml:id="datetimezone.getlocation" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>DateTimeZone::getLocation</refname>
<refname>timezone_location_get</refname>
<refpurpose>返回与时区相关的定位信息</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<para>&style.oop;</para>
<methodsynopsis role="DateTimeZone">
<modifier>public</modifier> <type class="union"><type>array</type><type>false</type></type><methodname>DateTimeZone::getLocation</methodname>
<void/>
</methodsynopsis>
<para>&style.procedural;</para>
<methodsynopsis>
<type class="union"><type>array</type><type>false</type></type><methodname>timezone_location_get</methodname>
<methodparam><type>DateTimeZone</type><parameter>object</parameter></methodparam>
</methodsynopsis>
<para>
返回时区的位置信息,包含国家代码,经纬度和注释。
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
&date.datetimezone.description;
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
包含时区的位置信息的数组&return.falseforfailure;
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>DateTimeZone::getLocation</function> 函数的示例</title>
<programlisting role="php">
<![CDATA[
<?php
$tz = new DateTimeZone("Asia/Jakarta");
print_r($tz->getLocation());
print_r(timezone_location_get($tz));
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
Array
(
[country_code] => ID
[latitude] => -6.16667
[longitude] => 106.8
[comments] => Java, Sumatra
)
Array
(
[country_code] => ID
[latitude] => -6.16667
[longitude] => 106.8
[comments] => Java, Sumatra
)
]]>
</screen>
</example>
</para>
<para>
<literal>country_code</literal> 元素包含每个条目的 ISO 3166-1 alpha-2 国家代码。<literal>latitude</literal>
<literal>longitude</literal> 元素包含从时区标识符中对应城市的坐标,<literal>comments</literal>
包含(当其值不为 &false; 时)该时区在指定国家适用区域的提示信息。此信息适合向最终用户展示。
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<simplelist>
<member><function>DateTimeZone::listIdentifiers</function>,以获得所有支持的时区标识符的完整或部分列表</member>
</simplelist>
</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
-->