05c01-1.php
来自「介绍PHP5的给类型函数应用」· PHP 代码 · 共 25 行
PHP
25 行
<?php// A function that returns a value one greater than the GET variable 'count'function increment_count() { if (isset($_GET['count'])) { return $_GET['count'] + 1; } else { return 1; }}// Save the value of the GET variable 'count', otherwise default to 0$counter = 0;if (isset($_GET['count'])) { $counter = $_GET['count'];}// Prepare a statement about the number of clicks:echo "<p>You have clicked on this page {$counter} times.</p>\n";// Now offer to let them click again, using PHP_SELF to automatically link// back to this script, and incrementing the count:echo '<p>Do you want to <a href="', $_SERVER['PHP_SELF'], '?count=', increment_count(), '">click again</a>?</p>';?>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?