1.练习post传值(手写)
post.html
文件
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>post传值</title>
</head>
<body>
<form action="post.php" method="post">
<label for="email">邮箱:</label>
<input type="email" id="email" name="email" placeholder="xxx@qq.com">
<label for="password">密码:</label>
<input type="password" id="password" name="password" placeholder="输入6位以上密码">
<button>登录</button>
</form>
</body>
</html>
post.php
文件
<?php
//_POST就是获取post传过来的值
print_r($_POST);
运行效果
手写代码
2.函数自行学习一些
<?php
//1、strtolower()转换小写
$str = 'JASON';
echo strtolower($str);
echo '<hr>';
$str = 'GUO';
echo strtolower($str);
//2、strtoupper()转换大写
$str = 'jason';
echo strtoupper($str);
echo '<hr>';
$str = 'guo';
echo strtoupper($str);
//3、strlen()获取长度
$str = 'jason';
echo strlen($str);
echo '<hr>';
$str = 'Guo';
echo strlen($str);
//4、trim() ltrim() rtrim()去除空格
$str = ' jason ';
echo trim($str);
echo '<hr>';
$str = ' guo ';
echo ltrim($str);
echo '<hr>';
$str = ' jack ';
echo rtrim($str);
echo '<hr>';
//5、str_replace()替换字符(选择需要替换的字符,替换后的字符)
$str = 'jason guo jack';
echo str_replace('jason','jack',$str);
echo '<hr>';
//6、strpbrk()查看是否包含某个字符
$str = 'jason guo jack';
echo str_replace($str,'guo');
echo '<hr>';
//7、explode()分割成数组
$str = 'jason guo jack';
$arr = explode(' ',$str);
print_r($arr);
echo '<hr>';
//8、implode()将数组转为字符串
$arr = array(
'jason',
'guo',
'jack'
);
echo implode(',',$arr);
echo '<hr>';
//9、md5()MD5加密
$str = 'jason';
echo md5($str);
echo '<hr>';