15c05-1.php

来自「介绍PHP5的给类型函数应用」· PHP 代码 · 共 25 行

PHP
25
字号
<?php// Include our file:$data = array();@include 'config.php';// If we were asked to make changes, then do so:if (count($_POST)) {    // Just update/add the value to the 'data' array    $data[$_POST['name']] = $_POST['val'];    // Now save it to disk, create the 'full' file wrapping it in valid PHP    $file = "<?php\n\$data = " . var_export($data, true) . ";\n?>\n";    file_put_contents('config.php', $file, LOCK_EX);}// Echo out the current dataecho "<pre>Current Data is:\n\n";print_r($data);echo "</pre>\n";?><form action="<?= $_SERVER['PHP_SELF'] ?>" method="post" name="myform"><p>Key: <input type="text" name="name" value="" /></p><p>Value: <input type="text" name="val" value="" /></p><input value="Save Data" type="submit" /></form>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?