Home > Article > CMS Tutorial > Analyze the common functions in the core file e/class/connect.php of the Empire CMS
The e/class/connect.php file under Imperial CMS contains some core functions commonly used in Imperial CMS. Deepen your understanding of the commonly used functions in the connect.php file. For Imperial CMS It is very important for secondary development.
The commonly used functions in the connect.php file of Empire CMS are excerpted as follows for your reference:
The code is as follows:
esub($string,$length,$dot='');//截取字符串函数,第三个参数为超过长度以后,在后面添加的字符串 make_password($pwd_length);//取得随机数 db_connect();//数据库连接 DoSetDbChar($dbchar);///设置数据库编码 db_close();//关闭数据库 esetcookie($var,$val,$life=0;$ecms=0);//设置cookie getvar($var,$ecms=0);//取得cookie printerror($error="",$gotourl="",$ecms=0;$noautourl=0;$novar=0;);//打印错误信息(对于运行成功的情况下也可调用该函数 执行js跳转!) egetip();取得ip地址 DoingReturnUrl($url,$from='');//返回地址 RepPostVar($var);//参数处理函数 GetFiletype($filename);//取得文件扩展名 RepGetFiletype($filetype);//文件名特殊字符(| , .等)过滤 GetFilename($filename);//取得文件名 sub($string,$start=0,$length,$mode=false,$dot='');//字符串截取函数$mode默认即可 no_make_password($pw_length);//取得随机数,这个是取得数字的 ToReturnRGB($reg);//颜色转rgb,#ff0000-->rgb(32,23,32) page1($num,$line,$page_line,$start,$page,$search);//前台分页 to_time($datetime);//时间转换函数 date_time($time,$format="Y-m-d H:i:s");//时间转日期函数 format_datetime($newstime,$format);//格式化日期 to_date($date);//时间转换 ReadFiletext($filepath);//取得文件内容,网络文件本地文件都可以 DoTitleFont($titlefont,$title);//格式化标题,增加一些粗体 SubSmalltextVal($value,$len);//截取简介 SubSchallSmalltext($value,$len);//全站搜索简介
It is recommended to study "Empire cms tutorial 》
In addition, for those who want to know more about the underlying functions of the Empire CMS, you can download the phpxref tool of this site: https://www.jb51.net/softs/58474.html to further query and analyze each Function definition and calling method!
The above is the detailed content of Analyze the common functions in the core file e/class/connect.php of the Empire CMS. For more information, please follow other related articles on the PHP Chinese website!