Blogger Information
Blog 26
fans 1
comment 0
visits 18863
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
get和post的数据处理过程
坏人也温柔de陈词滥调
Original
685 people have browsed it

foreach遍历演示实例

实例

<?php

$folk= '我得家人';
$folk=[0=>'爷爷', 1=>'妈妈',2=>'爸爸'];
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title><?php echo $folk;?></title>
</head>
<body>

<h2 style="..."><?php echo $folk;?></h2>

<ul>
    <li><?php echo$folk[0];?></li>
    <li><?php echo$folk[1];?></li>
    <li><?php echo$folk[2];?></li>
</ul>
<hr>
<ul>
<<?php foreach ($folk as $folk): ?>
    <li><a href=""><?php echo $folk; ?></a></li>
<?php endforeach;?>
</ul>
</body>
</html>

运行实例 »

点击 "运行实例" 按钮查看在线实例

post请求

实例

<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>get</title>
</head>
<body>
<form action="">
    <p>
        <label for="email">邮箱:</label>
        <input type="email" id="email" name="email" value="<?php echo isset($_GET['email']) ? $_GET['email'] : ''; ?>">
    </p>
    <p>
        <label for="password">密码:</label>
        <input type="password" id="password" name="password" value="">

    </p>
    <p>
        <button>登陆</button>
    </p>

</form>


</body>
</html>
<?php
echo '<pre>'.
    print_r($_POST);
?>

运行实例 »

点击 "运行实例" 按钮查看在线实例

get请求

实例

<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>get</title>
</head>
<body>
<form action="">
    <p>
        <label for="email">邮箱:</label>
        <input type="email" id="email" name="email" value="<?php echo isset($_GET['email']) ? $_GET['email'] : ''; ?>">
    </p>
    <p>
        <label for="password">密码:</label>
        <input type="password" id="password" name="password" value="">

    </p>
    <p>
        <button>登陆</button>
    </p>

</form>


</body>
</html>
<?php
echo '<pre>'.
    print_r($_GET);
?>

运行实例 »

点击 "运行实例" 按钮查看在线实例

三元运算符

实例

echo isset($_GET['email']) ? $_GET['email'] : '';

echo '<pre>';
print_r($_GET);
?>

运行实例 »

点击 "运行实例" 按钮查看在线实例


Correction status:qualified

Teacher's comments:请求类型, 这是指http的 , get和post是最常用的,其实还有put,delete
Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!