企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
# 帝国CMS常用函数 ``` <pre class="calibre15">``` 函数<span class="token1">:</span><span class="token3">printerror</span><span class="token1">(</span><span class="token1">)</span> 功能<span class="token1">:</span>提示信息 位置<span class="token1">:</span><span class="token">/</span>e<span class="token">/</span><span class="token2">class</span><span class="token">/</span>connect<span class="token1">.</span>php line <span class="token5">108</span> 参数<span class="token1">:</span> $error<span class="token1">:</span>提示信息 $gotourl<span class="token1">:</span>转向地址 例子<span class="token1">:</span><span class="token3">printerror</span><span class="token1">(</span><span class="token4">"RegisterSuccess"</span><span class="token1">,</span><span class="token4">"history.go(-1)"</span><span class="token1">,</span><span class="token5">1</span><span class="token1">)</span><span class="token1">;</span> <span class="token6">//返回上个页面.</span> 函数<span class="token1">:</span><span class="token3">ReturnLeftLevel</span><span class="token1">(</span><span class="token1">)</span> 功能<span class="token1">:</span>验证操作权限 位置<span class="token1">:</span><span class="token">/</span>e<span class="token">/</span><span class="token2">class</span><span class="token">/</span>functions<span class="token1">.</span>php line <span class="token5">3144</span> 参数<span class="token1">:</span> $groupid<span class="token1">:</span>组id 函数<span class="token1">:</span><span class="token3">checklevel</span><span class="token1">(</span><span class="token1">)</span> 功能<span class="token1">:</span>验证操作权限 位置<span class="token1">:</span> <span class="token">/</span>e<span class="token">/</span><span class="token2">class</span><span class="token">/</span>functions<span class="token1">.</span>php line <span class="token5">3154</span> 参数<span class="token1">:</span> $userid<span class="token1">:</span>用户id $username<span class="token1">:</span>用户名 $classid<span class="token1">:</span>栏目id $enews<span class="token1">:</span>模块名 <span class="token6">//$enews="news"</span> 函数<span class="token1">:</span><span class="token3">insert_dolog</span><span class="token1">(</span><span class="token1">)</span> 功能<span class="token1">:</span>记录日志 位置<span class="token1">:</span><span class="token">/</span>e<span class="token">/</span><span class="token2">class</span><span class="token">/</span>functions<span class="token1">.</span>php line <span class="token5">3295</span> 参数<span class="token1">:</span> $doing<span class="token1">:</span>日志信息 函数<span class="token1">:</span><span class="token3">db_connect</span><span class="token1">(</span><span class="token1">)</span> 功能<span class="token1">:</span>连接数据库 位置<span class="token1">:</span> <span class="token">/</span>e<span class="token">/</span><span class="token2">class</span><span class="token">/</span>connect<span class="token1">.</span>php line <span class="token5">43</span> 参数<span class="token1">:</span>无 函数<span class="token1">:</span><span class="token3">db_close</span><span class="token1">(</span><span class="token1">)</span> 功能<span class="token1">:</span>关闭数据库 位置<span class="token1">:</span><span class="token">/</span>e<span class="token">/</span><span class="token2">class</span><span class="token">/</span>connect<span class="token1">.</span>php line <span class="token5">86</span> 参数<span class="token1">:</span>无 函数<span class="token1">:</span><span class="token3">is_login</span><span class="token1">(</span><span class="token1">)</span> 功能<span class="token1">:</span>是否登录 位置<span class="token1">:</span><span class="token">/</span>e<span class="token">/</span><span class="token2">class</span><span class="token">/</span>functions<span class="token1">.</span>php line <span class="token5">3184</span> 参数<span class="token1">:</span> <span class="token6">//不需要参数也能验证是否登录</span> $uid<span class="token1">:</span>用户id $uname<span class="token1">:</span>帐号 $urnd<span class="token1">:</span>随机码 例子<span class="token1">:</span>$lur<span class="token">=</span><span class="token3">is_login</span><span class="token1">(</span><span class="token1">)</span><span class="token1">;</span> <span class="token6">//返回一个用户数组</span> 函数<span class="token1">:</span><span class="token3">RepPostVar</span><span class="token1">(</span><span class="token1">)</span> 功能<span class="token1">:</span>字符串替换处理 位置<span class="token1">:</span><span class="token">/</span>e<span class="token">/</span><span class="token2">class</span><span class="token">/</span>connect<span class="token1">.</span>php line <span class="token5">309</span> 参数<span class="token1">:</span> $val<span class="token1">:</span>字符串 函数<span class="token1">:</span><span class="token3">gettotal</span><span class="token1">(</span><span class="token1">)</span> 功能<span class="token1">:</span>统计记录数 位置<span class="token1">:</span><span class="token">/</span>e<span class="token">/</span><span class="token2">class</span><span class="token">/</span>db_sql<span class="token1">.</span>php line <span class="token5">52</span> 参数<span class="token1">:</span> $query<span class="token1">:</span>sql语句 函数<span class="token1">:</span><span class="token3">lastid</span><span class="token1">(</span><span class="token1">)</span> 功能<span class="token1">:</span>获得最后执行sql的id 位置<span class="token1">:</span><span class="token">/</span>e<span class="token">/</span><span class="token2">class</span><span class="token">/</span>db_sql<span class="token1">.</span>php line <span class="token5">70</span> 参数<span class="token1">:</span>无 函数<span class="token1">:</span><span class="token3">getcvar</span><span class="token1">(</span><span class="token1">)</span> 功能<span class="token1">:</span>返回cookie <span class="token">/</span> <span class="token3">配合esetcookie</span><span class="token1">(</span><span class="token1">)</span>使用 位置<span class="token1">:</span><span class="token">/</span>e<span class="token">/</span><span class="token2">class</span><span class="token">/</span>connect<span class="token1">.</span>php line <span class="token5">125</span> 参数<span class="token1">:</span> $<span class="token2">var</span><span class="token1">:</span>必填 cookie名 $ecms<span class="token1">:</span>选填<span class="token1">,</span> <span class="token5">0</span>是前台<span class="token1">.</span> <span class="token5">1</span>是后台<span class="token1">.</span> 默认<span class="token5">0.</span> 函数<span class="token1">:</span><span class="token3">esetcookie</span><span class="token1">(</span><span class="token1">)</span> 功能<span class="token1">:</span>设置cookie <span class="token">/</span> 函数向客户端发送一个 <span class="token5">HTTP</span> cookie 主要带了帝国<span class="token5">CMS</span>前后台cookie前缀 path 等用起来方便 位置<span class="token1">:</span><span class="token">/</span>e<span class="token">/</span><span class="token2">class</span><span class="token">/</span>connect<span class="token1">.</span>php line <span class="token5">118</span> 参数<span class="token1">:</span> $<span class="token2">var</span><span class="token1">:</span>必填 cookie名 $val<span class="token1">:</span>必填 cookie值 $life<span class="token1">:</span>选填<span class="token1">,</span>过期unix时间戳 $ecms<span class="token1">:</span>选填<span class="token1">,</span> <span class="token5">0</span>是前台<span class="token1">.</span> <span class="token5">1</span>是后台<span class="token1">.</span> 默认<span class="token5">0.</span> 函数<span class="token1">:</span><span class="token3">LoadLang</span><span class="token1">(</span><span class="token1">)</span> 功能<span class="token1">:</span>载入语言包 位置<span class="token1">:</span><span class="token">/</span>e<span class="token">/</span><span class="token2">class</span><span class="token">/</span>connect<span class="token1">.</span>php line <span class="token5">294</span> 参数<span class="token1">:</span> $file<span class="token1">:</span>语言包文件名 函数<span class="token1">:</span><span class="token3">islogin</span><span class="token1">(</span><span class="token1">)</span> 功能<span class="token1">:</span>验证是否登录 位置<span class="token1">:</span><span class="token">/</span>e<span class="token">/</span><span class="token2">class</span><span class="token">/</span>user<span class="token1">.</span>php line <span class="token5">775</span> 参数<span class="token1">:</span> $uid<span class="token1">:</span>用户id $uname<span class="token1">:</span>帐号 $urnd<span class="token1">:</span>随机码 例子<span class="token1">:</span>$user_r<span class="token">=</span><span class="token3">islogin</span><span class="token1">(</span><span class="token1">)</span><span class="token1">;</span> <span class="token6">//返回一个用户数组</span> 函数<span class="token1">:</span><span class="token3">Close</span><span class="token1">(</span><span class="token1">)</span> 功能<span class="token1">:</span>关闭<span class="token5">SMTP</span> 位置<span class="token1">:</span><span class="token">/</span>e<span class="token">/</span><span class="token2">class</span><span class="token">/</span><span class="token2">class</span><span class="token1">.</span>smtp<span class="token1">.</span>php line <span class="token5">193</span> 参数<span class="token1">:</span>无 函数<span class="token1">:</span><span class="token3">reppoststr</span><span class="token1">(</span><span class="token1">)</span> 功能<span class="token1">:</span>处理提交字符 位置<span class="token1">:</span><span class="token">/</span>e<span class="token">/</span><span class="token2">class</span><span class="token">/</span>connect<span class="token1">.</span>php line <span class="token5">381</span> 参数<span class="token1">:</span> $val<span class="token1">:</span>字符串 $ecms<span class="token1">:</span>默认为<span class="token5">0.</span> 例子<span class="token1">:</span>$val<span class="token">=</span><span class="token3">RepPostStr</span><span class="token1">(</span>$val<span class="token1">,</span><span class="token5">1</span><span class="token1">)</span><span class="token1">;</span> 函数<span class="token1">:</span><span class="token3">page2</span><span class="token1">(</span><span class="token1">)</span> 功能<span class="token1">:</span>后台分页 位置<span class="token1">:</span><span class="token">/</span>e<span class="token">/</span><span class="token2">class</span><span class="token">/</span>functions<span class="token1">.</span>php line <span class="token5">58</span> 参数<span class="token1">:</span> $num<span class="token1">:</span>总数 $line<span class="token1">:</span>每页显示多少条 $page_line<span class="token1">:</span>每页显示链接数 $start<span class="token1">:</span>没用 $page<span class="token1">:</span>当前页号加<span class="token5">1</span> $search<span class="token1">:</span>参数 <span class="token6">//&orderby=0&mydesc=0 </span> 例子<span class="token1">:</span>$returnpage<span class="token">=</span><span class="token3">page2</span><span class="token1">(</span>$num<span class="token1">,</span>$line<span class="token1">,</span>$page_line<span class="token1">,</span>$start<span class="token1">,</span>$page<span class="token1">,</span>$search<span class="token1">)</span><span class="token1">;</span><span class="token6">//http: //192.168.0.55/ListUser.php?page=0&orderby=0&mydesc=0</span> 函数<span class="token1">:</span><span class="token3">page1</span><span class="token1">(</span><span class="token1">)</span> 功能<span class="token1">:</span>前台分页 位置<span class="token1">:</span><span class="token">/</span>e<span class="token">/</span><span class="token2">class</span><span class="token">/</span>connect<span class="token1">.</span>php line <span class="token5">539</span> 参数<span class="token1">:</span>$num<span class="token1">:</span>总数 $line<span class="token1">:</span>每页显示多少条 $page_line<span class="token1">:</span>每页显示链接数 $start<span class="token1">:</span>没用 $page<span class="token1">:</span>当前页号加<span class="token5">1</span> $search<span class="token1">:</span>参数 <span class="token6">//&orderby=0&mydesc=0 </span> 例子<span class="token1">:</span>$returnpage<span class="token">=</span><span class="token3">page1</span><span class="token1">(</span>$num<span class="token1">,</span>$line<span class="token1">,</span>$page_line<span class="token1">,</span>$start<span class="token1">,</span>$page<span class="token1">,</span>$search<span class="token1">)</span><span class="token1">;</span><span class="token6">//http: //192.168.0.55/ListUser.php?page=0&orderby=0&mydesc=0</span> 函数<span class="token1">:</span><span class="token3">SpOpenChFile</span><span class="token1">(</span><span class="token1">)</span> 功能<span class="token1">:</span>上传图片 位置<span class="token1">:</span><span class="token">/</span>e<span class="token">/</span>admin<span class="token">/</span>AddNews<span class="token1">.</span>php line <span class="token5">399</span> 参数<span class="token1">:</span> type<span class="token1">:</span>类型 <span class="token6">//1是图片.2是flash文件.3是多媒体文件.0是其他附件.</span> field<span class="token1">:</span>默认是titlepic<span class="token1">.</span>应该是标题图片的意思 函数<span class="token1">:</span><span class="token3">GetTemptb</span><span class="token1">(</span><span class="token1">)</span> 功能<span class="token1">:</span>返回模板表名 位置<span class="token1">:</span><span class="token">/</span>e<span class="token">/</span><span class="token2">class</span><span class="token">/</span>connect<span class="token1">.</span>php line <span class="token5">248</span> 参数<span class="token1">:</span> $temptb<span class="token1">:</span>表名 例子<span class="token1">:</span>select tempid<span class="token1">,</span>tempname <span class="token2">from</span> <span class="token3">GetTemptb</span><span class="token1">(</span><span class="token4">"enewsvotetemp"</span><span class="token1">)</span> 函数<span class="token1">:</span><span class="token3">RepPhpAspJspcode</span><span class="token1">(</span><span class="token1">)</span> 功能<span class="token1">:</span>替换php代码里的<span class="token4">"<\\"</span><span class="token1">,</span><span class="token4">"<?"</span><span class="token1">,</span><span class="token4">"<%"</span>为<span class="token4">"&lt;\\"</span><span class="token1">,</span><span class="token4">"&lt;?"</span><span class="token1">,</span><span class="token4">"&lt;%"</span> 位置<span class="token1">:</span><span class="token">/</span>e<span class="token">/</span><span class="token2">class</span><span class="token">/</span>q_functions<span class="token1">.</span>php line <span class="token5">47</span> 参数<span class="token1">:</span> $string<span class="token1">:</span>字符串 函数<span class="token1">:</span><span class="token3">sys_ReturnBqTitleLink</span><span class="token1">(</span><span class="token1">)</span> 功能<span class="token1">:</span>返回标题连接 位置<span class="token1">:</span><span class="token">/</span>e<span class="token">/</span><span class="token2">class</span><span class="token">/</span>connect<span class="token1">.</span>php line <span class="token5">797</span> 参数<span class="token1">:</span> $r<span class="token1">:</span>从数据库获取的数组 函数<span class="token1">:</span><span class="token3">GetConfig</span><span class="token1">(</span><span class="token1">)</span> 功能<span class="token1">:</span>更新配置文件config<span class="token1">.</span>php 位置<span class="token1">:</span><span class="token">/</span>e<span class="token">/</span><span class="token2">class</span><span class="token">/</span>functions<span class="token1">.</span>php line <span class="token5">4745</span> 参数<span class="token1">:</span> $domod<span class="token1">:</span>默认为<span class="token5">0</span>,为<span class="token5">1</span>时更新e<span class="token">/</span><span class="token2">class</span><span class="token">/</span>config<span class="token1">.</span>php文件 例子<span class="token1">:</span><span class="token3">GetConfig</span><span class="token1">(</span><span class="token5">1</span><span class="token1">)</span><span class="token1">;</span> 函数<span class="token1">:</span><span class="token3">to_time</span><span class="token1">(</span><span class="token1">)</span> 功能<span class="token1">:</span>返回unix时间戳 位置<span class="token1">:</span><span class="token">/</span>e<span class="token">/</span><span class="token2">class</span><span class="token">/</span>connect<span class="token1">.</span>php line <span class="token5">587</span> 参数<span class="token1">:</span> $datetime<span class="token1">:</span>时间 <span class="token6">//日期类型格式如:2012-12-12 日期时间如:2012-12-12 12:12:12</span> 函数<span class="token1">:</span><span class="token3">doUtfAndGbk</span><span class="token1">(</span><span class="token1">)</span> 功能<span class="token1">:</span>编码转化 位置<span class="token1">:</span><span class="token">/</span>e<span class="token">/</span><span class="token2">class</span><span class="token">/</span>user<span class="token1">.</span>php line <span class="token5">50</span> 参数<span class="token1">:</span> $str<span class="token1">:</span>字符串 $phome<span class="token1">:</span>默认为<span class="token5">0.</span>为<span class="token5">0</span>时是<span class="token5">UTF8</span>转<span class="token5">GBK</span><span class="token1">.</span> 为<span class="token5">1</span>时是<span class="token5">GBK</span>转<span class="token5">UTF8</span>。 函数<span class="token1">:</span><span class="token3">CheckFileMod</span><span class="token1">(</span><span class="token1">)</span> 功能<span class="token1">:</span>检查文件或目录的权限 位置<span class="token1">:</span><span class="token">/</span>e<span class="token">/</span>admin<span class="token">/</span>PathLevel<span class="token1">.</span>php line <span class="token5">37</span> 参数<span class="token1">:</span> $filename<span class="token1">:</span>文件或目录地址 $smallfile<span class="token">=</span><span class="token4">""</span><span class="token1">:</span>默认为空<span class="token1">.</span> 例子<span class="token1">:</span><span class="token">/</span><span class="token7">/1、CheckFileMod("../</span><span class="token1">.</span><span class="token1">.</span><span class="token">/</span>d<span class="token4">","</span><span class="token1">.</span><span class="token1">.</span><span class="token">/</span><span class="token1">.</span><span class="token1">.</span><span class="token">/</span>d<span class="token">/</span>txt"<span class="token1">)</span> <span class="token6">//2、CheckFileMod("../../s")</span> 函数<span class="token1">:</span><span class="token3">WriteFiletext_n</span><span class="token1">(</span><span class="token1">)</span> 功能<span class="token1">:</span>写入文件 位置<span class="token1">:</span><span class="token">/</span>e<span class="token">/</span><span class="token2">class</span><span class="token">/</span>connect<span class="token1">.</span>php line <span class="token5">671</span> 备注<span class="token1">:</span><span class="token3">WriteFiletext_n</span><span class="token1">(</span><span class="token1">)</span> <span class="token3">和WriteFiletext</span><span class="token1">(</span><span class="token1">)</span><span class="token3">功能一样,WriteFiletext</span><span class="token1">(</span><span class="token1">)</span>写入的时候删除由 <span class="token1">[</span><span class="token3">addslashes</span><span class="token1">(</span><span class="token1">)</span><span class="token1">]</span><span class="token1">(</span>http<span class="token1">:</span><span class="token">/</span><span class="token">/</span>www<span class="token1">.</span>w3school<span class="token1">.</span>com<span class="token1">.</span>cn<span class="token">/</span>php<span class="token">/</span>func_string_addslashes<span class="token1">.</span>asp <span class="token4">"PHP addslashes() 函数"</span><span class="token1">)</span> 函数添加的反斜杠。 参数<span class="token1">:</span> $filepath<span class="token1">:</span>文件地址 $string<span class="token1">:</span>要写入的内容 例子<span class="token1">:</span> <span class="token"><</span><span class="token">?</span>php $jsfile<span class="token">=</span><span class="token4">"../data/fc/cmsclass.js"</span><span class="token1">;</span> <span class="token3">WriteFiletext_n</span><span class="token1">(</span>$jsfile<span class="token1">,</span><span class="token4">"document.write(\""</span><span class="token1">.</span><span class="token3">addslashes</span><span class="token1">(</span>$jsstr<span class="token1">)</span><span class="token1">.</span><span class="token4">"\");"</span><span class="token1">)</span><span class="token1">;</span> <span class="token">?</span><span class="token">></span> 函数<span class="token1">:</span><span class="token3">sub</span><span class="token1">(</span><span class="token1">)</span> 功能<span class="token1">:</span>截取字符串 位置<span class="token1">:</span><span class="token">/</span>e<span class="token">/</span><span class="token2">class</span><span class="token">/</span>connect<span class="token1">.</span>php line <span class="token5">442</span> 参数<span class="token1">:</span> $string<span class="token1">:</span>字符串 $start<span class="token1">:</span>默认是<span class="token5">0.</span>开始截取的位置 $length<span class="token1">:</span>截取的长度 $mode<span class="token">=</span><span class="token5">false</span><span class="token1">:</span>默认是<span class="token5">false</span><span class="token1">.</span> $dot<span class="token1">:</span>默认为空<span class="token1">.</span>截取后末尾的字符。例如<span class="token1">:</span><span class="token">...</span><span class="token">...</span><span class="token1">.</span> 例子<span class="token1">:</span><span class="token3">sub</span><span class="token1">(</span>$value<span class="token1">,</span><span class="token5">0</span><span class="token1">,</span>$subtitle<span class="token1">,</span><span class="token5">false</span><span class="token1">,</span><span class="token4">''</span><span class="token1">)</span><span class="token1">;</span> 函数<span class="token1">:</span><span class="token3">esub</span><span class="token1">(</span><span class="token1">)</span> 功能<span class="token1">:</span>截取字数 位置<span class="token1">:</span><span class="token">/</span>e<span class="token">/</span><span class="token2">class</span><span class="token">/</span>connect<span class="token1">.</span>php line <span class="token5">498</span> 参数<span class="token1">:</span> $string<span class="token1">:</span>字符串 $length<span class="token1">:</span>截取长度 $dot<span class="token1">:</span>默认为空。例如<span class="token1">:</span><span class="token">...</span><span class="token">...</span><span class="token">...</span><span class="token1">.</span><span class="token1">.</span> 函数<span class="token1">:</span><span class="token3">egetip</span><span class="token1">(</span><span class="token1">)</span> 功能<span class="token1">:</span>获取ip 位置<span class="token1">:</span><span class="token">/</span>e<span class="token">/</span><span class="token2">class</span><span class="token">/</span>connect<span class="token1">.</span>php line <span class="token5">300</span> 参数<span class="token1">:</span>无 函数<span class="token1">:</span><span class="token3">ReadFiletext</span><span class="token1">(</span><span class="token1">)</span> 功能<span class="token1">:</span>获取文件内容 位置<span class="token1">:</span><span class="token">/</span>e<span class="token">/</span><span class="token2">class</span><span class="token">/</span>connect<span class="token1">.</span>php line <span class="token5">637</span> 参数<span class="token1">:</span> $filepath<span class="token1">:</span>文件地址 函数<span class="token1">:</span><span class="token3">DoMkdir</span><span class="token1">(</span><span class="token1">)</span> 功能<span class="token1">:</span>建立目录 位置<span class="token1">:</span><span class="token">/</span>e<span class="token">/</span><span class="token2">class</span><span class="token">/</span>connect<span class="token1">.</span>php line <span class="token5">708</span> 参数<span class="token1">:</span> $path<span class="token1">:</span>要建立的目录 函数<span class="token1">:</span><span class="token3">DoChmodFile</span><span class="token1">(</span><span class="token1">)</span> 功能<span class="token1">:</span>设置上传文件的目录权限 位置<span class="token1">:</span><span class="token">/</span>e<span class="token">/</span><span class="token2">class</span><span class="token">/</span>connect<span class="token1">.</span>php line <span class="token5">741</span> 参数<span class="token1">:</span> $file<span class="token1">:</span>目录 函数<span class="token1">:</span><span class="token3">SubSmalltextVal</span><span class="token1">(</span><span class="token1">)</span> 功能<span class="token1">:</span>截取简介 位置<span class="token1">:</span><span class="token">/</span>e<span class="token">/</span><span class="token2">class</span><span class="token">/</span>connect<span class="token1">.</span>php line <span class="token5">1218</span> 参数<span class="token1">:</span> $value<span class="token1">:</span>字符串 $len<span class="token1">:</span>要截取的长度 函数<span class="token1">:</span><span class="token3">GetFiletype</span><span class="token1">(</span><span class="token1">)</span> 功能<span class="token1">:</span>获取文件扩展名 位置<span class="token1">:</span><span class="token">/</span>e<span class="token">/</span><span class="token2">class</span><span class="token">/</span>connect<span class="token1">.</span>php line <span class="token5">411</span> 参数<span class="token1">:</span> $filename<span class="token1">:</span>文件名 函数<span class="token1">:</span><span class="token3">clearaddsdata</span><span class="token1">(</span><span class="token1">)</span> 功能<span class="token1">:</span>删除由 <span class="token1">[</span><span class="token3">addslashes</span><span class="token1">(</span><span class="token1">)</span><span class="token1">]</span><span class="token1">(</span>http<span class="token1">:</span><span class="token">/</span><span class="token">/</span>www<span class="token1">.</span>w3school<span class="token1">.</span>com<span class="token1">.</span>cn<span class="token">/</span>php<span class="token">/</span>func_string_addslashes<span class="token1">.</span>asp <span class="token4">"PHP addslashes() 函数"</span><span class="token1">)</span> 函数添加的反斜杠。 位置<span class="token1">:</span><span class="token">/</span>e<span class="token">/</span><span class="token2">class</span><span class="token">/</span>connect<span class="token1">.</span>php line <span class="token5">2046</span> 参数<span class="token1">:</span> $data<span class="token1">:</span>字符串 函数<span class="token1">:</span><span class="token3">AddAddsData</span><span class="token1">(</span><span class="token1">)</span> 功能<span class="token1">:</span>添加反斜杠 位置<span class="token1">:</span><span class="token">/</span>e<span class="token">/</span><span class="token2">class</span><span class="token">/</span>connect<span class="token1">.</span>php line <span class="token5">2055</span> 参数<span class="token1">:</span> $data<span class="token1">:</span>字符串 函数<span class="token1">:</span><span class="token3">wipespecial</span><span class="token1">(</span><span class="token1">)</span> 功能<span class="token1">:</span>回车替换 位置<span class="token1">:</span><span class="token">/</span>e<span class="token">/</span><span class="token2">class</span><span class="token">/</span>ftp<span class="token1">.</span>php line <span class="token5">8</span> 参数<span class="token1">:</span> $str<span class="token1">:</span>字符串 函数<span class="token1">:</span><span class="token3">ReplaceFc</span><span class="token1">(</span><span class="token1">)</span> 功能<span class="token1">:</span>替换回车 位置<span class="token1">:</span><span class="token">/</span>e<span class="token">/</span><span class="token2">class</span><span class="token">/</span>ftp<span class="token1">.</span>php line <span class="token5">8</span> 参数<span class="token1">:</span> $str<span class="token1">:</span>字符串 函数<span class="token1">:</span><span class="token3">ReturnFormHidden</span><span class="token1">(</span><span class="token1">)</span> 功能<span class="token1">:</span>添加隐藏表单项 位置<span class="token1">:</span><span class="token">/</span>e<span class="token">/</span><span class="token2">class</span><span class="token">/</span>functions<span class="token1">.</span>php line <span class="token5">388</span> 参数<span class="token1">:</span> $vname<span class="token1">:</span>name值 $value<span class="token1">:</span>value值 例子<span class="token1">:</span><span class="token"><</span>input type<span class="token">=</span>hidden name<span class="token">=</span>\<span class="token4">""</span><span class="token1">.</span>$vname<span class="token1">.</span><span class="token4">"\" value=\""</span><span class="token1">.</span>$value<span class="token1">.</span>"\"<span class="token">></span> 函数<span class="token1">:</span><span class="token3">GetHtml</span><span class="token1">(</span><span class="token1">)</span> 功能<span class="token1">:</span>生成内容页 位置<span class="token1">:</span><span class="token">/</span>e<span class="token">/</span><span class="token2">class</span><span class="token">/</span>functions<span class="token1">.</span>php line <span class="token5">1992</span> 参数<span class="token1">:</span> $add<span class="token1">:</span>当前要生成内容页的数组 函数<span class="token1">:</span><span class="token3">make_password</span><span class="token1">(</span><span class="token1">)</span> 功能<span class="token1">:</span>获取随机数 位置<span class="token1">:</span><span class="token">/</span>e<span class="token">/</span><span class="token2">class</span><span class="token">/</span>connect<span class="token1">.</span>php line <span class="token5">503</span> 参数<span class="token1">:</span> $pw_length<span class="token1">:</span>位数 函数<span class="token1">:</span><span class="token3">DoTitleFont</span><span class="token1">(</span><span class="token1">)</span> 功能<span class="token1">:</span><span class="token3">标题属性</span><span class="token1">(</span>粗体<span class="token">/</span>斜体<span class="token">/</span>删除线<span class="token1">)</span> 位置<span class="token1">:</span><span class="token">/</span>e<span class="token">/</span><span class="token2">class</span><span class="token">/</span>connect<span class="token1">.</span>php line <span class="token5">683</span> 参数<span class="token1">:</span> $titlefont<span class="token1">:</span>信息数组的titlefont字段 $title<span class="token1">:</span>信息数组的title字段 例子<span class="token1">:</span><span class="token3">DoTitleFont</span><span class="token1">(</span>$r<span class="token1">[</span>titlefont<span class="token1">]</span><span class="token1">,</span>$r<span class="token1">[</span>title<span class="token1">]</span><span class="token1">)</span> 函数<span class="token1">:</span><span class="token3">InstallShowMsg</span><span class="token1">(</span><span class="token1">)</span> 功能<span class="token1">:</span>js提示跳转返回 位置<span class="token1">:</span><span class="token">/</span>e<span class="token">/</span>install<span class="token">/</span>data<span class="token">/</span>fun<span class="token1">.</span>php line <span class="token5">218</span> 参数<span class="token1">:</span> $msg<span class="token1">:</span>提示信息 $url<span class="token1">:</span>网址 <span class="token3">一、esub</span><span class="token1">(</span><span class="token1">)</span>截取字段函数 <span class="token3">语法:esub</span><span class="token1">(</span>字符串<span class="token1">,</span>截取字数<span class="token1">,</span>后缀<span class="token1">)</span> 说明:后缀为截取字符后附带内容,此参数可以省略。 使用范例: <span class="token"><</span><span class="token">?</span><span class="token">=</span><span class="token3">esub</span><span class="token1">(</span><span class="token4">'12345678'</span><span class="token1">,</span><span class="token5">6</span><span class="token1">)</span><span class="token">?</span><span class="token">></span>,返回结果为:<span class="token5">123456</span> <span class="token"><</span><span class="token">?</span><span class="token">=</span><span class="token3">esub</span><span class="token1">(</span><span class="token4">'12345678'</span><span class="token1">,</span><span class="token5">6</span><span class="token1">,</span><span class="token4">'...'</span><span class="token1">)</span><span class="token">?</span><span class="token">></span>,返回结果为:<span class="token5">123456.</span><span class="token1">.</span><span class="token1">.</span> <span class="token3">二、date</span><span class="token1">(</span><span class="token1">)</span>转换时间格式函数 <span class="token3">语法:date</span><span class="token1">(</span>时间格式<span class="token1">,</span>时间戳<span class="token1">)</span> 说明:<span class="token5">PHP</span>本身函数,使用说明可以参考:http<span class="token1">:</span><span class="token">/</span><span class="token">/</span>cn<span class="token1">.</span>php<span class="token1">.</span>net<span class="token">/</span>manual<span class="token">/</span>en<span class="token">/</span><span class="token2">function</span><span class="token1">.</span>date<span class="token1">.</span>php 使用范例: <span class="token"><</span><span class="token">?</span><span class="token">=</span><span class="token3">date</span><span class="token1">(</span><span class="token4">'Y-m-d H:i:s'</span><span class="token1">,</span><span class="token5">1277865010</span><span class="token1">)</span><span class="token">?</span><span class="token">></span>,返回结果为:<span class="token5">2010</span><span class="token">-</span><span class="token5">06</span><span class="token">-</span><span class="token5">30</span> <span class="token5">10</span><span class="token1">:</span><span class="token5">30</span><span class="token1">:</span><span class="token5">10</span> <span class="token3">三、format_datetime</span><span class="token1">(</span><span class="token1">)</span>转换时间格式函数<span class="token5">2</span> <span class="token3">语法:format_datetime</span><span class="token1">(</span>正常时间<span class="token1">,</span>时间格式<span class="token1">)</span> <span class="token3">说明:和date</span><span class="token1">(</span><span class="token1">)</span>的区别是format_datetime是转换正常时间,而date是转换unix时间戳。 使用范例: <span class="token"><</span><span class="token">?</span><span class="token">=</span><span class="token3">format_datetime</span><span class="token1">(</span><span class="token4">'2010-06-30 10:30:10'</span><span class="token1">,</span><span class="token4">'m/d'</span><span class="token1">)</span><span class="token">?</span><span class="token">></span>,返回结果为:<span class="token5">06</span><span class="token">/</span><span class="token5">30</span> 四、通过<span class="token5">ID</span>取得栏目地址函数 <span class="token3">语法:sys_ReturnBqClassname</span><span class="token1">(</span>$r<span class="token1">,</span><span class="token5">9</span><span class="token1">)</span> 说明:$r为含栏目<span class="token5">ID</span>的数组,变量名可任意命名。 使用范例:取得栏目<span class="token5">ID</span><span class="token">=</span><span class="token5">2</span>的栏目地址。 <span class="token"><</span><span class="token">?</span>php $cr<span class="token1">[</span><span class="token4">'classid'</span><span class="token1">]</span><span class="token">=</span><span class="token5">2</span><span class="token1">;</span> $classurl<span class="token">=</span><span class="token3">sys_ReturnBqClassname</span><span class="token1">(</span>$cr<span class="token1">,</span><span class="token5">9</span><span class="token1">)</span><span class="token1">;</span> echo $classurl<span class="token1">;</span> <span class="token">?</span><span class="token">></span> 通过<span class="token5">ID</span><span class="token3">取得栏目地址的其他方法:</span> <span class="token1">(</span><span class="token5">1</span><span class="token1">)</span>、<span class="token">/</span>e<span class="token">/</span><span class="token2">public</span><span class="token">/</span>ClassUrl<span class="token">/</span><span class="token">?</span>classid<span class="token">=</span>栏目<span class="token5">ID</span> <span class="token1">(</span><span class="token5">2</span><span class="token1">)</span>、<span class="token">/</span><span class="token"><</span><span class="token">?</span><span class="token">=</span>$class_r<span class="token1">[</span>栏目<span class="token5">ID</span><span class="token1">]</span><span class="token1">[</span><span class="token4">'classpath'</span><span class="token1">]</span><span class="token">?</span><span class="token">></span> 五、取得信息内容页地址函数 <span class="token3">语法:sys_ReturnBqTitleLink</span><span class="token1">(</span>$r<span class="token1">)</span> 说明:$r为含“id<span class="token1">,</span>classid<span class="token1">,</span>newspath<span class="token1">,</span>filename<span class="token1">,</span>groupid<span class="token1">,</span>titleurl”字段内容的数组,变量名可任意命名。 使用范例:取得信息<span class="token5">ID</span><span class="token">=</span><span class="token5">8</span>的新闻页面地址 <span class="token"><</span><span class="token">?</span>php $nr<span class="token">=</span>$empire<span class="token">-</span><span class="token">></span><span class="token3">fetch1</span><span class="token1">(</span><span class="token4">"select id,classid,newspath,filename,groupid,titleurl from {$dbtbpre}ecms_news where id='8' limit 1"</span><span class="token1">)</span><span class="token1">;</span> $titleurl<span class="token">=</span><span class="token3">sys_ReturnBqTitleLink</span><span class="token1">(</span>$nr<span class="token1">)</span><span class="token1">;</span> echo $titleurl<span class="token1">;</span> <span class="token">?</span><span class="token">></span> 通过<span class="token5">ID</span>取得信息内容页地址的其他方法: <span class="token">/</span>e<span class="token">/</span><span class="token2">public</span><span class="token">/</span>InfoUrl<span class="token">/</span><span class="token">?</span>classid<span class="token">=</span>栏目<span class="token5">ID</span><span class="token">&</span>id<span class="token">=</span>信息<span class="token5">ID</span> 六、提示信息函数<span class="token5">1</span> <span class="token3">语法:printerror</span><span class="token1">(</span>$error<span class="token1">,</span>$gotourl<span class="token1">,</span>$ecms<span class="token1">,</span>$noautourl<span class="token1">,</span>$novar<span class="token1">)</span> 说明: $error:提示信息内容,可以为语言包变量,也可以直接提示内容。 $gotourl:提示信息转向链接地址 <span class="token3">$ecms:0为后台提示信息、1为前台提示信息、8为后台提示信息</span><span class="token1">(</span>alert方式<span class="token1">)</span><span class="token3">、9为前台提示信息</span><span class="token1">(</span>alert方式<span class="token1">)</span> $noautourl:<span class="token5">0</span>为自动转向页面,<span class="token5">1</span>为不自动转向页面。此参数可省略,默认为<span class="token5">0</span> $novar:<span class="token5">0</span>为提示信息内容采用语言包变量,<span class="token5">1</span>为提示信息内容为直接提示内容。此参数可以省略,默认为<span class="token5">0</span> 使用范例: <span class="token3">printerror</span><span class="token1">(</span><span class="token4">'DbError'</span><span class="token1">,</span><span class="token4">'http://www.phome.net'</span><span class="token1">,</span><span class="token5">1</span><span class="token1">)</span>,前台提示,提示信息内容为语言包DbError变量内容,转向帝国网站 <span class="token3">printerror</span><span class="token1">(</span><span class="token4">'数据库出错'</span><span class="token1">,</span><span class="token4">'http://www.phome.net'</span><span class="token1">,</span><span class="token5">1</span><span class="token1">,</span><span class="token5">0</span><span class="token1">,</span><span class="token5">1</span><span class="token1">)</span>,前台提示,提示信息内容为“数据库出错”,转向帝国网站 附加说明: 此函数需结合$editor变量来确定目录层次。默认$editor变量为<span class="token5">0</span>。 当程序文件在<span class="token">/</span>e<span class="token">/</span>path<span class="token">/</span>目录,$editor不用设置,也就是用默认<span class="token5">0</span>。 当程序文件在<span class="token">/</span>e<span class="token">/</span>path<span class="token">/</span>path2<span class="token">/</span>目录,$editor<span class="token">=</span><span class="token5">1</span>。 当程序文件在<span class="token">/</span>e<span class="token">/</span>path<span class="token">/</span>path2<span class="token">/</span>path3<span class="token">/</span>目录,$editor<span class="token">=</span><span class="token5">2</span>。 当程序文件在<span class="token">/</span>e<span class="token">/</span>path<span class="token">/</span>path2<span class="token">/</span>path3<span class="token">/</span>path4<span class="token">/</span>目录,$editor<span class="token">=</span><span class="token5">3</span>。 <span class="token3">七、提示信息函数2</span> <span class="token1">(</span>直接提示内容<span class="token1">)</span> <span class="token3">语法:printerror2</span><span class="token1">(</span>$error<span class="token1">,</span>$gotourl<span class="token1">,</span>$ecms<span class="token1">,</span>$noautourl<span class="token1">)</span> 说明: $error:直接提示信息的内容。 $gotourl:提示信息转向链接地址 <span class="token3">$ecms:0为默认提示信息方式、9为弹出提示信息方式</span><span class="token1">(</span>alert方式<span class="token1">)</span>。此参数可省略,默认为<span class="token5">0</span> $noautourl:<span class="token5">0</span>为自动转向页面,<span class="token5">1</span>为不自动转向页面。此参数可省略,默认为<span class="token5">0</span> 使用范例: <span class="token3">printerror2</span><span class="token1">(</span><span class="token4">'添加完毕'</span><span class="token1">,</span><span class="token4">'http://www.phome.net'</span><span class="token1">)</span>,提示信息内容为“添加完毕”,转向帝国网站 附加说明: 此函数不需要结合其他变量,可以在任意目录层次使用。不支持使用语言包变量。 八、设置系统<span class="token5">COOKIE</span>变量函数 <span class="token3">语法:esetcookie</span><span class="token1">(</span>$<span class="token2">var</span><span class="token1">,</span>$val<span class="token1">,</span>$life<span class="token1">,</span>$ecms<span class="token1">)</span> 说明: $<span class="token2">var</span>:为变量名 $val:为变量值 $life:为<span class="token5">COOKIE</span>有效时间,单位秒,<span class="token5">0</span>为不保存。此参数可省略,默认为不保存。 $ecms:<span class="token5">0</span>为设置前台<span class="token5">COOKIE</span>变量,<span class="token5">1</span>为设置后台<span class="token5">COOKIE</span>变量。此参数可省略,默认为<span class="token5">0</span>。 使用范例: <span class="token3">esetcookie</span><span class="token1">(</span><span class="token4">'mybody'</span><span class="token1">,</span><span class="token4">'帝国'</span><span class="token1">)</span>,定义前台“<span class="token5">COOKIE</span>前缀<span class="token">+</span>mybody”变量,变量内容为“帝国” <span class="token3">esetcookie</span><span class="token1">(</span><span class="token4">'mybody'</span><span class="token1">,</span><span class="token4">'帝国'</span><span class="token1">,</span><span class="token5">0</span><span class="token1">,</span><span class="token5">1</span><span class="token1">)</span>,定义后台“<span class="token5">COOKIE</span>前缀<span class="token">+</span>mybody”变量,变量内容为“帝国” 附加说明: 此设置<span class="token5">COOKIE</span>函数会给变量名加上<span class="token5">COOKIE</span>前缀,你可也可以直接用<span class="token5">PHP</span>本身的setcookie来定义。 九、取得系统<span class="token5">COOKIE</span>变量函数 <span class="token3">语法:getcvar</span><span class="token1">(</span>$<span class="token2">var</span><span class="token1">,</span>$ecms<span class="token1">)</span> 说明: $<span class="token2">var</span>:为变量名 $ecms:<span class="token5">0</span>为设置前台<span class="token5">COOKIE</span>变量,<span class="token5">1</span>为设置后台<span class="token5">COOKIE</span>变量。此参数可省略,默认为<span class="token5">0</span>。 使用范例: <span class="token3">getcvar</span><span class="token1">(</span><span class="token4">'mlusername'</span><span class="token1">)</span>,取得前台登陆会员的用户名 <span class="token3">getcvar</span><span class="token1">(</span><span class="token4">'loginusername'</span><span class="token1">,</span><span class="token5">1</span><span class="token1">)</span>,取得后台登陆管理员的用户名 附加说明: 此取得<span class="token5">COOKIE</span>函数是取得变量名加上<span class="token5">COOKIE</span>前缀的变量,你可也可以直接用<span class="token5">PHP</span>本身的$_COOKIE<span class="token1">[</span><span class="token4">'变量名'</span><span class="token1">]</span>来取得。 十、取得<span class="token5">IP</span>地址函数 <span class="token3">语法:egetip</span><span class="token1">(</span><span class="token1">)</span> 使用范例: <span class="token"><</span><span class="token">?</span>php $ip<span class="token">=</span><span class="token3">egetip</span><span class="token1">(</span><span class="token1">)</span><span class="token1">;</span> echo $ip<span class="token1">;</span> <span class="token">?</span><span class="token">></span> 十一、动态页面显示分页函数 <span class="token3">语法:page1</span><span class="token1">(</span>$num<span class="token1">,</span>$line<span class="token1">,</span>$page_line<span class="token1">,</span>$start<span class="token1">,</span>$page<span class="token1">,</span>$search<span class="token1">)</span> 说明: $num:总记录数 $line:每页显示数量 $page_line:每页显示分页链接数 $start:预设变量,设置<span class="token5">0</span>即可。 <span class="token3">$page:当前页码</span><span class="token1">(</span><span class="token5">0</span>为起始页码<span class="token1">)</span> $search:链接附加参数 十二、通过栏目<span class="token5">ID</span>取得栏目名和栏目别名方法: 栏目名:<span class="token"><</span><span class="token">?</span><span class="token">=</span>$class_r<span class="token1">[</span>栏目<span class="token5">ID</span><span class="token1">]</span><span class="token1">[</span><span class="token4">'classname'</span><span class="token1">]</span><span class="token">?</span><span class="token">></span> 栏目别名:<span class="token"><</span><span class="token">?</span><span class="token">=</span>$class_r<span class="token1">[</span>栏目<span class="token5">ID</span><span class="token1">]</span><span class="token1">[</span><span class="token4">'bname'</span><span class="token1">]</span><span class="token">?</span><span class="token">></span> ``` ```