常用小知识总结

原创 2019-05-29 17:27:51 147
摘要:<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0">&

<!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

发布手记

热门词条