지원되는 파일 유형(Strings)

.PHP - 배열 (Strings)

컨텐츠는 영어 텍스트를 Phrase Language AI를 이용해 기계 번역한 것입니다.

파일 확장명

.php

API 확장

php_array

가져오기

내보내기

복수형 지원

아니요

설명 지원

아니요

배열은 항목의 순서가 지정된 목록 또는 컬렉션입니다. 배열의 항목은 PHP에서 기본적으로 숫자, 문자열, 객체, 다른 배열 등 모든 유형이 될 수 있습니다. 우리는 종종 로캘 메시지 배열에서 Strings를 값으로 사용합니다. PHP 배열에는 두 가지 주요한 문제가 있습니다:

  • 인덱스 배열 — 이 배열은 암시적으로 순서가 지정됩니다(예: ['빨간색', '녹색', '파란색']).

  • 연관 배열 — 이 배열은 키(정수 또는 문자열일 수 있음)와 연결된 값의 쌍을 포함합니다(예: ['first_name' => 'Adam', 'last_name' => 'McMan', 'age' => 22]).

배열 요소의 값은 초기화 중에 설정하거나 배열 자체의 변수 이름을 사용하여 설정할 수 있습니다.

<?php

// 초기화 중

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

// 변수 이름 사용 

$my_second_array['key'] = 'value'

이러한 값 설정 방식은 혼합하여 사용할 수 있습니다.

배열 작업

명령줄에서 가져올 때 메시지 파일은 키와 값이 연결된 명명된 배열을 사용하여 다음 형식으로 전송됩니다.

<?php

$lang['키'] = '번역된 메시지';

$lang['또 다른 키'] = '또 다른 번역된 메시지';

앱이 이러한 형식으로 작업하도록 설정되었는지 확인하십시오. 메시지 파일에서 익명 배열을 반환하지 말고 메시지 배열에 $lang 이름을 사용하십시오.

코드 샘플

<?php

$lang['boolean_key'] = '--- true
';
$lang['empty_string_translation'] = '';
$lang['key_with_description'] = 'key_with_description,Check it out! 이 키에는 설명이 있습니다! (최소 일부 형식으로)';
$lang['key_with_line-break'] = 'key_with_line-break,"This translations contains
a line-break.';
$lang['nested.deeply.key'] = 'Wow, this key is nested even deeper.';
$lang['nested.key'] = 'This key is nested inside a namespace.';
$lang['null_translation'] = '';
$lang['sample_collection'] = '---
- first item
- second item
- third item
';
$lang['simple_key'] = 'Just a simple key with a simple message.';
$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.