2016-01-23 17 views
0

我有PHP文件像下面,我想读这个PHP文件,并在此PHP文件得到所有数组值,我可以更新阵列修改从php文件数组值笨或php

<?php 
$lang['country_name']="Country Name"; 
$lang['zip_code']="Zip Code"; 
$lang['flag']="Flag"; 
$lang['site_enabled']="Site Enabled"; 
$lang['save']="Save"; 
$lang['cancel']="Cancel"; 
$lang['country_info']="Country Information"; 
$lang['new_country']="New Country"; 
$lang['edit_country']="Edit Counry"; 
$lang['country']="Country"; 
$lang['home']="Home"; 
$lang['no']="No"; 
$lang['action']="Action"; 
$lang['show']="Show"; 
?> 
+0

这与codeigniter有什么关系? –

+0

你是如何加载语言文件你做它一样的http://www.codeigniter.com/user_guide/libraries/language.html – user4419336

回答

0

的价值如果您想将此PHP数组包含在另一个脚本中,则可以使用include函数。

例如,如果您有另一个文件index.php在同一个目录中,那么您可以include它然后您将有权访问该变量。你可以修改它像一个正常的变量,就像这样:

index.php

<?php 
    include `lang_array.php`; // will get the file with the array 
    echo $lang["no"];   // should output "No" 
    $lang["show"] = "value"; // update $lang["show"] 
?> 
+0

,但我怎么可以通过表格更新数组值 –

+0

不正确的方式加载语言在codeigniter http://www.codeigniter.com/user_guide/libraries/language.html – user4419336

+0

@ wolfgang1983除了标题和标签之外,没有明确提及codeigniter。另外,我对codeigniter不熟悉,所以这是我的最佳解决方案。 –

0

简单,你只需要包含文件使用PHP包括功能。

<?php 
include 'file_name.php'; 
$lang['new_country']="new country 1"; 
?>