首页 > 代码库 > Building Web Pages with PHP(1)- links and urls

Building Web Pages with PHP(1)- links and urls

1、PHP获得用户端数据的三个来源:

get post cookie

2、$_GET的用法,$_GET是通过url来获得值的,所以,我么这里建立两个最简单的网页,first_page.php 和second_page.php

first_page.php

1 <?php 2 $link = ‘second_page.php?id=1&name=王建华‘;3 $linkName = ‘第二个页面‘;4 ?>5 <a href= http://www.mamicode.com/<?php echo $link; ?>><?php echo $linkName?></a>

second_page.php

<?php var_dump($_GET);

则点击first_page.php中的链接,我们将得到的页面是:

array(2) { ["id"]=> string(1) "1" ["name"]=> string(9) "王建华" }

这既是$_GET的用法

 

Building Web Pages with PHP(1)- links and urls