douba1617 2016-01-23 02:23
浏览 48

在codeigniter或php中修改php文件中的数组值

i have php file like below and i want to read this php file and get all array value in this php file and i can update value of array

<?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";
?>
  • 写回答

2条回答 默认 最新

  • doujing5435 2016-01-23 02:38
    关注

    If you want to include this PHP array in another script, you can use the include function.

    For example, if you have another file, index.php in the same directory, you can include it and then you will have access to the variable. You can modify it like a normal variable, like so:

    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"]
    ?>
    
    评论

报告相同问题?

悬赏问题

  • ¥15 关于用pyqt6的项目开发该怎么把前段后端和业务层分离
  • ¥30 线性代数的问题,我真的忘了线代的知识了
  • ¥15 有谁能够把华为matebook e 高通骁龙850刷成安卓系统,或者安装安卓系统
  • ¥188 需要修改一个工具,懂得汇编的人来。
  • ¥15 livecharts wpf piechart 属性
  • ¥20 数学建模,尽量用matlab回答,论文格式
  • ¥15 昨天挂载了一下u盘,然后拔了
  • ¥30 win from 窗口最大最小化,控件放大缩小,闪烁问题
  • ¥20 易康econgnition精度验证
  • ¥15 msix packaging tool打包问题