php 语法及其项目

php 语法及其项目

一、 PHP简介

认识PHP

PHP Hypertext Preprecessor 超文本预处理器 可以嵌入到html代码中的

PHP通用开源动态脚本语言,运行在服务端,适合高效快捷的进行web开发

通常用于创建动态生成的网页,支持常用的数据库 MySql, mariaDB ,Oracle, MongoDB

php发展史

php5 2004-7 引入了面向对象编程 5.4 trait 5.6

php7 201搭建项目系统点我wcqh.cn5-12 性能是 php5.6提高了2倍

php7.4 提供了pre-loading预加载机制,实现了部分程序的常驻内存

4 2020-11 PHP8.0问世 高效的JIT just-in-time(即使编译)运算支持,PHP 已经应用到 websocket服务,高性能web,物联网,即时通讯,游戏,微服务等非web领域的系统开发

PHP 工作运行原理

二、 PHP语法

PHP include request区别

(1)、include 遇到错误还继续,非常适合模版

(2)、request遇到错误就停止

三、 PHP项目实例

目录结构

(1)data存储是数组

(2)template\public存储是网页头、网页搭建项目系统点我wcqh.cn底公共模版,都是用include 引用

(3)static存储js css等

template\public 头部底部模板如下

头部模板<!DOCTYPE html><html lang=“zh-CN”><head><? $arr =requiredata/data.php; $navs =requiredata/nav.php;?><meta charset=“UTF-8”/><meta httpequiv=“X-UA-Compatible” content=“IE=edge”/><meta name=“viewport” content=“width=device-width, initial-scale搭建项目系统点我wcqh.cn=1.0″/><meta name=“keywords” content=“<?= $arr[keywords] ?>”/><meta name=“description” content=“<?= $arr[des] ?>”/><link rel=“stylesheet” href=“static/css/style.css”/><title><?= $arr[title]?></title></head><body><!–页眉–><!–修改php.ini open_short_tag On–><header><nav><a href=“index.php”>首页</a><?foreach($搭建项目系统点我wcqh.cnnavsas $k => $v):?><a href=“news.php”><?= $v[name]?></a><? endforeach;?></nav></header><!– 页脚 –><footer><div>青狐资源网&copy;版权所有(2022-2025)</div></footer></body></html>

data存储是数组

return[[“id”=>1,name=>新闻],[“id”=>2,name=>产品],[“id”=>3,name=>联系],[“id”=>4,name=>登录],];return array(“keywords”=>“新闻,产品,合肥”,“des”=>“专搭建项目系统点我wcqh.cn业生产中高档办公家具,行业畅销20年”,“title”=>“首頁”);

首页如下

<!– 引入页眉 –><?php include template/public/header.php?><!– 主体 –><main><!– 新闻列表 –><divclass=“news”><h3>新闻列表</h3><divclass=“list”><ahref=“”>切实做好高风险岗位从业人员疫情防控。</a><ahref=“”>切实做好高风险岗位从业人员疫情防控。</a><ahref=“”>切实做好高风险岗位从业人员疫情防控。</a><ahref=“”>切实做好高风险岗位从业人员疫情防控。</a><a搭建项目系统点我wcqh.cnhref=“”>切实做好高风险岗位从业人员疫情防控。</a></div></div><!– 产品列表 –><divclass=“items”><h3>产品列表</h3><divclass=“list”><divclass=“item”><imgsrc=“static/images/item1.jpeg”alt=“”/><ahref=“”>最新产品1</a></div><divclass=“item”><imgsrc=“static/images/item2.jpeg”alt=“”/><ahref=“”>最新产品2</a></div><divclass=“item”><ahref=“”><i搭建项目系统点我wcqh.cnmgsrc=“static/images/item3.jpeg”alt=“”/></a><ahref=“”>最新产品3</a></div><divclass=“item”><imgsrc=“static/images/item4.jpeg”alt=“”/><ahref=“”>最新产品4</a></div></div></div></main><!– 引入页脚 –><?php include template/public/footer.php?>
批改老师:PHPz 批改状态:合格 老师批语:
作者最新博文
2021-09-23 09:51:01

© 版权声明
THE END
喜欢就支持一下吧
点赞905 分享
评论 抢沙发

请登录后发表评论

    暂无评论内容