2013-04-17 29 views
0

我正在嘗試讀取文本文件的字符。從文本文件中獲取字符php

$lang['content.home'] = 'Home'; 
$lang['content.about_us'] = 'About Us'; 
$lang['content.team'] = 'team'; 

如何得到的只是性格

content.home首頁

content.about_us關於我們

content.team團隊

我嘗試使用爆炸( '\'」,$數據),而不是由foreach正常工作

+1

你想要什麼格式的結果? – silkfire

+0

陣列(1) ( [0] =>串(5) 「content.home」 [1] =>串(5) 「家」 ) –

+0

你不想include_once()的它爲什麼究竟? –

回答

0

你可以得到$langkeyvalue

$lang['content.home'] = 'Home'; 
$lang['content.about_us'] = 'About Us'; 
$lang['content.team'] = 'team'; 
foreach($lang as $key=>$value){ 
    echo $key."<br>\n"; 
    echo $value; 
} 
+0

如果我回聲$值只​​顯示HomeAbout UsTeam如何獲取content.home或content.about_us或content.team? –

+0

把回聲放在'foreach'裏面見編輯 –

+0

我有問題我得到$ lang ['content.home] ='Home';從文件文本$ lang = read_file(APPPATH。「language/english/content_lang.php」);和$ lang不能用foreach請幫忙 –