$config->sidebar2 = ''; #goes inside right side of page $config->nav1["page.php"] = "New Page!"; #add a new page to end of nav1 (viewable this page only)!! $config->nav1 = array("page.php"=>"New Page!") + $config->nav1; #add a new page to beginning of nav1 (viewable this page only)!! */ //END CONFIG AREA ---------------------------------------------------------- # Read the value of 'action' whether it is passed via $_POST or $_GET with $_REQUEST if (isset($_REQUEST['act'])) { $myAction = trim($_REQUEST['act']); } else { $myAction = ""; } switch ($myAction) { //check 'act' for type of process case "display": # 2)Display user's name! showName(); break; default: # 1)Ask user to enter their name showForm(); } function showForm() { # shows form so user can enter their name. Initial scenario get_header(); #defaults to header_inc.php ?> <script type="text/javascript" src="<?php echo VIRTUAL_PATH; ?> include/util.js"></script>
<?php /* * 函数 * * * */ //1 自定义函数 function showName() { return "anikin"; } echo showName() . '<br/>'; // 可变函数就是:通过变量调用函数,后面一定要加上括号 $ch = 'showName'; echo $ch(); // 可变函数也是可以用在对象身上的 class Person { function showAge() { return 23; } } $p1 = 'showAge'; $per = new Person(); echo '<br/>' . $per->showAge(); // 内置函数 str_replace 替换 删除 $str = "anikin not is my first-name"; $str = str_replace('not', ' ', $str);