PHP网页简单编写
2023-02-18 16:48:11 时间
php是指超文本预处理器,是在服务器执行的脚本语言。其语言的风格类似于C++和Java。
先尝试输出一个hallo world
<?php
echo"hallo world";
?>
或者这样输出
<?php
$weikang = "hello world";
echo $weikang;
?>
在html镶嵌是这样
<?php
$weikang1 = "hello world";
?>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<title><?php echo $weikang1; ?></title>
</head>
<body>
<p><?php echo $weikang1; ?></p>
</body>
</html>
或者是这样
<?php
$weikang1 = "hello world";
?>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<title><?=$weikang1; ?></title>
</head>
<body>
<p><?=$weikang1; ?></p>
</body>
</html>
php if结构
<?php
$weikang = 1;
if (weikang==1){
echo "hallo world";
}else{
echo "bye world";
}
?>
php函数编写
输出hallo world代码
<?php
function weikang(){
echo "hello world";
}
weikang();
?>
输出带数值版
<?php
function weikang($about){
echo $about;
}
weikang(1);
?>
php面向对象编写
面向函数是把问题进行抽象化
<?php
class weikangnb{
public function _construct(){
echo "hallo world";
}
}
new weikangnb();
本片文章到此为止,有问题或者其他需要补充请联系我哦
相关文章
- 【Golang】golang实现发送微信服务号模板消息
- 【Golang】golang实现sha256加密函数
- 【Golang】golang实现md5加密函数
- 【Golang】golang实现post请求发送form类型数据函数
- 【Golang】golang实现urlencode urldecode函数
- 【Golang】对接百度翻译API-golang版本sdk代码
- [golang] golang实现截取字符串函数SubStr
- 在线客服聊天系统源码_美观强大golang内核开发_二进制运行傻瓜式安装_附搭建教程
- [golang] 解决配置goland时候The selected directory is not a valid home for Go SDK
- [Golang] golang中使用正则表达式替换字符串
- [Golang] golang中使用正则表达式获取子字符串
- [Golang] Goland 编辑器 替换快捷键
- GOFLY智能在线客服系统更新日志: APP端历史访客分页功能更新 (2022-04-07)
- GOFLY智能在线客服系统更新日志: APP端历史访客列表增加搜索功能 (2022-04-07)
- git pull报错Pulling is not possible because you have unmerged files
- [Golang]解决 os.Mkdir的时候出现 The system cannot find the path specified
- [Golang] 向上取整和向下取整的实现
- [Go] 解决gorm unsupported destination, should be slice or struct
- GOFLY在线客服系统_微信小程序客服对接_小程序webview内嵌访客链接教程
- GOFLY在线客服系统/外贸网站在线客服+多语言支持 外贸网站即时通讯工具/中英文切换教程