支持文件类型 (Strings)

PHP - 数组((Strings))

文本由 Phrase Language AI 从英语机器翻译而得。

文件扩展名

.php

API扩展

php_array

导入

可以

导出

可以

复数形式支持

没有

描述支持

没有

数组是一个有序的列表或项目的集合。数组的项在 PHP 中基本上可以是任何类型的:一个数字、字符串、一个对象、另一个数组等。我们通常在区域消息数组中使用 Strings 作为值。 PHP 数组严重有两种:

  • 已索引 — ⁇ 这些阵列是按照隐式顺序排列的,例如[“红色”、“绿色”、“蓝色”]

  • 关联性 — 这些数组包含字符串(可以是整数或 Strings)和关联的值,例如 [“first_name” => “Adam”,“last_name” => “McMan”,“age” => 22]

数组元素的值可以在初始化过程中设置,也可以使用数组本身的变量名称。

<?php

初始化过程中

$my_array = ['foo' => 'bar'];

/ / 使用变量名称 

$my_second_array['key'] = 'value'

这种设置值的方法可以混合和匹配。

使用阵列

从命令行拉取时,将使用关联的命名阵列以以下格式发送消息文件。

<?php

$lang['key'] = '译文';

$lang['other_key'] = 'Another translation message';

确保应用程序设置为使用这种格式工作。不要在消息文件中返回匿名数组,并为消息数组使用名称$lang

代码示例

<?php

$lang['boolean_key'] = '--- true
';
$lang['empty_string_translation'] = '';
$lang['key_with_description''] ='看看吧!这个字键有说明!(至少某些格式)';
$lang['key_with_line-break'] = 'This translations contains
一次换行。');
$lang['nested.deeply.key'] ='哇,这个键嵌套的更深。');
$lang['nested.key'] ='该键嵌套在名称空间内。';
$lang['null_translation'] = '';
$lang['sample_collection'] = '---
— 第一项
- 第二项
- 第三个项目
';
$lang['simple_key'] ='只是一个带有简单信息的简单键。';
$lang['unverified_key'] ='此翻译尚未验证,请等待。(某些格式我们也会导出这种状态)';
这篇文章有帮助吗?

Sorry about that! In what way was it not helpful?

The article didn’t address my problem.
I couldn’t understand the article.
The feature doesn’t do what I need.
Other reason.

Note that feedback is provided anonymously so we aren't able to reply to questions.
If you'd like to ask a question, submit a request to our Support team.
Thank you for your feedback.