返回 常用小知识总结... 登陆

常用小知识总结

过儿 2019-05-29 17:27:51 134

<!DOCTYPE html>

<html lang="en">

<head>

<meta charset="UTF-8">

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<meta http-equiv="X-UA-Compatible" content="ie=edge">

<title>Document</title>

</head>

<body>

<?php

$str = "China is the most beautiful country.";

echo substr($str,-8,3)."<br>";

echo strstr($str,"mo",true)."<br>";

echo strpos($str,"mo")."<br>";


$str = "China is the most beautiful country.";

echo str_replace('China','American',$str)."<br>";

echo str_replace(['China','is','most'],['American','are','best'],$str)."<br>";

echo substr_replace($str,'***',6)."<br>";

echo "<hr>";


$str1="http://www.baidu.com";

echo urlencode($str1)."<br>";

echo urldecode($str1)."<br>";


$array = ["语文","数学","英语"];

echo json_encode($array)."<br>";

?>

</body>

</html>

本章讲解的都是常用的小知识点,应该多看几遍,熟记熟用@!

QQ图片20190529173132.png

最新手记推荐

• 用composer安装thinkphp框架的步骤 • 省市区接口说明 • 用thinkphp,后台新增栏目 • 管理员添加编辑删除 • 管理员添加编辑删除

全部回复(0)我要回复

暂无评论~
  • 取消 回复 发送
  • PHP中文网