<?PHP <br />class test{//类开始<br> function echo_str(){print "this is test files";}<br><br>}//类结束<br>?>testone.php文件<?PHP <br />$a = new test;<br>$a->echo_str();<br>function __autoload(strtolower($className)){ //strtolower是自动转化为小写字母(当然你可以不用strtolower,因为php5会自动将其转化为小写的)<br> require_once($className.".php"); //自动加载类文件,根据类的名称给予文件名(即为加载规则)<br>}<br>?>运行testone.php,output "this is test files"
PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号