php第八节课

时间:2023-03-09 16:22:39
php第八节课

加载

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head>

<body>
<?php

//面向对象三大特性
//封装,目的;
//做法;
//继承,概念;
//特点;
//多态,概念;
//条件;

//加载类
//include("Info.class.php"); //将类文件夹载到页面,参数是路径(找到类文件)

//include "\study/PHP/php-video/wamp/www/info.class.php";

//require_once "./info.class.php"; //请求目标页面一次
//require_once ("./info.class.php");
//require("info.class.php");

//自动加载类
function _autoload($classname)
{
include(/*"../".*/$classname.".class.php");
}

//相对路径
//当前目录: ./
//上级目录 ../
//下级目录: 目录名/
//根目录: /
//如果是在php代码里面 /代表本地磁盘的根(E)
//如果是在html里面 /代表当前站点目录

$info = new Info();
$info->name = "张三";

var_dump($info);

?>

<img src=""

</body>
</html>

<?php

class Info
{
public $code;
public $name;
public $sex;
public $nation;
public $birthday;
}