SQLite 查询类 $sqlite->init($file, $flag, $key) // Set the Database Class $sqlite->connect() // Dummy function for the interface $sqlite->selectDB($file, $flag, $key) // Set a SQLite connection $sqlite->query($sql) // Execute a Query, Result into $sqlite->DB_resut $sqlite->getRS() // Return The Current Result as an Array and Set the Point of Result to the Next Result $sqlite->record($sql) // Get the first line of the record set $sqlite->result($sql) // Get the single value of the query with the parameters of buildSel function $sqlite->GetFields($tbl) // Get the Columns List of a Table as an Array $sqlite->getTbls($the_db) // Get the Tables List of Current Selected Database as an Array $sqlite->getCreateScript($the_tbl) // Get the Whole structure of Current Selected Database as an Array $sqlite->getDataScript($the_tbl) // Get All of The Data of a Table $sqlite->getInsertId() // Return auto increment id generate by insert query $sqlite->create($name, $para, $type) // Create Object $sqlite->drop($name, $para, $type) // Drop Object $sqlite->select() // Build a select query use the SQL builder and execute it $sqlite->update() // Build a replace query use the SQL builder and execute it $sqlite->delete() // Build a delete query use the SQL builder and execute it $sqlite->replace() // Build a replace query use the SQL builder and execute it $sqlite->free() // Free the $sqlite->DB_result in order to Release the System Resource $sqlite->close(&$err_info) // Close Current MySQL Link $sqlite->checkError() // Check if error occured $sqlite->clearError() // Clear Errors Information $sqlite->error($str) // Handle the Errors
MSSQL数据库查询 $MSSQL = new MSSQL($host, $user, $pass, $charse) // Set the Database Class $MSSQL->connect($the_db) // Build a Connection to MSSQL to $MSSQL->conn $MSSQL->reconnect($the_db) // Rebuild a Connection to MySQL to $mysql->DB_conn $MSSQL->SelectDB($the_db) // Select a Database of MSSQL to $MSSQL->select (Must Build Connect First) $MSSQL->convertSQL($sql) // Convert MySQL query to MSSQL $MSSQL->convertLimit($sql) // convert sql query string include limit grammar of mysql to mssql sql query string $MSSQL->query($sql) // Execute a Query of MSSQL, Result into $MSSQL->resut $MSSQL->getRS() // Return The Current Result as an Array and Set the Point of Result to the Next Result $MSSQL->record($sql, $mode) // Get the first line of the recordset $MSSQL->records($sql, $mode) // Get all the lines of the recordset $MSSQL->result($line, $field) // The Same Use as sqlsrv_result $MSSQL->getDBs() // Get the Databases List of Current MySQL Server as an Array $MSSQL->getTbls($the_db) // Get the Tables List of Current Selected Database as an Array $MSSQL->getInsertId() // Return auto increment id generate by insert query $MSSQL->getFields() // Get the Columns List of a table $MSSQL->getPri($the_tbl) // Get the Primary Keys of a Table as an Array $MSSQL->getCreateScript($the_tbl, $the_db) // Get the Whole Struction of Current Selected Database as an Array $MSSQL->getDataScript($the_tbl) // Get All of The Data of a Table $MSSQL->getIdxScript($the_tbl) // Get the Indexes List of a Table as an Array $MSSQL->getStat() // Get the Current Status of MSSQL $MSSQL->file($file) // Read SQL File and execute it $MSSQL->handleSQL($strSQL) // Split the SQL Query String into a array from a whole String $MSSQL->create($name, $para, $type) // Create Object $MSSQL->drop($name, $para, $type) // Drop Object $MSSQL->select() // Build a select query use the SQL builder and execute it $MSSQL->update() // Build a replace query use the SQL builder and execute it $MSSQL->delete() // Build a delete query use the SQL builder and execute it $MSSQL->replace() // Build a replace query use the SQL builder and execute it $MSSQL->batchExec($SQLs) // Execute Multi Query from an Array (Use HandleSQL First) $MSSQL->check($obj, $type) // Check if a db object works $MSSQL->free() // Free the $MSSQL->result in order to Release the System Resource $MSSQL->close() // Close Current MSSQL Link $MSSQL->checkError() // Check if error occured $MSSQL->clearError() // Clear Errors Information $MSSQL->error($str) // Handle the Errors
缓存代理类 $mycache->init($mode, $setting) // 类对象初始化 $mycache->set($key, $value, $ttl) // 设置缓存 $mycache->get($key) // 获取缓存 $mycache->remove($key) // 删除缓存 $mycache->clean() // 清除缓存 $mycache->change($module, $setting) // 变更缓存模块 $mycache->getData($query, $mode, $ttl) // 数据库查询缓存 $mycache->getData_func($func, $args, $ttl) // 函数结果缓存
设置信息处理类 $config = new myConfig($file); $config->catalog1->item = 'somevalue'; $config->catalog2->item = 'somevalue'; $config->save('php|ini|json'); $config->build($setting_detail); $config->set($_POST['setting']);
控制器基础类,含单实例控制 self::getInstance($calledClass) // 取得类实例 $this->setSingleton($singleton) // 设置单实例模式 $this->setAddedContent($position, $content) // 设置页面附加内容 $this->pushAddedContent(myTemplate $tpl) // 插入页面附加内容 $this->setLanguage($language) // 设置语言 $this->setLanguagePack($dir, $lng) // 设置语言包 $this->getLanguage($idx) // 获取语言项目 $this->regApi($name, $method) // 设置应用接口(用于数据传输) $this->runApi($name) // 调用应用接口 $this->regPlugin($plugin) // 注册插件 $this->plugin() // 执行现有插件 $this->regModule($module, $func) // 设置模块脚本(用于功能页面) $this->module($module, $global_vars) // 调用模块 $this->regTag($tag_name, $tag_func) // 添加模版标签解析方法 $this->regUrl($mode, $func) // 添加URL生成规则 $this->url($mode) // 生成URL $this->regLog($login, $logout, $chg_psw) // 设置用户登录接口 $this->login($user_name, $user_pwd) // 用户登录 $this->logout() // 用户退出 $this->chg_psw($id, $psw_old, $psw_new) // 变更密码 $this->addCSS($code) // 添加样式表(代码或文件) $this->removeCSS($idx) // 去除样式表 $this->clearCSS() // 清空现有样式表 $this->CSS($show, $cache_path, $expires) // 获取样式表 $this->addJS($code) // 添加JS脚本(代码或文件) $this->removeJS($idx) // 去除JS脚本 $this->clearJS() // 清空现有JS脚本 $this->JS($show, $cache_path, $expires) // 获取JS脚本 self::etag($etag) // 通过过期标签显示内容 self::file($file) // 显示文件 self::guid($para) // 生成唯一ID $this->setFunction($func, $position) // 添加钩子程序 $this->run($position, $desc) // 执行钩子代码 $this->start($charset) // 页面脚本执行初始化 $this->show(myTemplate $tpl) // 显示页面 $this->end() // 页面脚本执行结束 self::redirect($url, $code) // 链接跳转 self::setOp($setting) // opCache 设置 self::regClass($setting) // 设置类载入规则 self::setAlias($list) // 设置类别名 self::header($idx, $para, $exit) // 发送信息头
电子邮件发送: $mail = new myEmail(); $mail->init($from, $charset, $log_file); $mail->setFrom('from@mailserver.com', 'name'); $mail->setSubject('mail subject'); $mail->setContent('mail content', true); $mail->addEmail('anymail@server.com', 'recipient name', 'to'); $mail->addEmail('anymail1@server.com', 'recipient name', 'cc'); $mail->addFile($file_at_server, $filename, $filetype, $embed); $mail->addHeader('Disposition-Notification-To', 'anymail@server.com'); $mail->send(array('mode'=>'smtp', 'host'=>'mailserver', 'port'=>25, 'user'=>'username', 'password'=>'psw'), true); or $mail->send(array('mode'=>'ssl', 'host'=>'smtp.gmail.com', 'port'=>465, 'user'=>'username@gmail.com', 'password'=>'password'));
加密解密 myEncrypt::keyED($str, $encrypt_key) // Class core myEncrypt::encStr($str, $key) // Encrypt a string myEncrypt::encFile($file, $key) // Encrypt a file myEncrypt::decStr($str, $key) // Decrypt a string myEncrypt::decFile($file, $key) // Decrypt a file
Excel 表格生成: $xls->init($file_name, $sheet_name) // Set the Database Class $xls->addSheet($sheet_name, $change_sheet) // add new sheet $xls->delSheet($sheet_name) // delete sheet $xls->resetSheet($sheet_name, $change_sheet) // empty sheet data $xls->chgSheet($sheet_name) // change working sheet $xls->addRow() // add a new working row to working sheet $xls->addCells($cells, $idx) // add data to working row $xls->getContent() // get xls file content $xls->make() // push content to browser
程序错误处理
文件处理 $this->__get // return the value of any public variant or from the info variant $this->__toString // return the value of content self::rootPath($mode = false) // return the real path of document root self::realPath($file, $mode = false) // return the real and safe path of some file self::mkdir($dir) // make a new directory with recursive feature self::getMime($file) // return the mime type of the file self::getAttrib($file, $show_txt = false) // return the attrib of the file self::setAttrib($file, $attrib) // set the attrib of the file self::getHeader($url, $mode = true) // return the headers of any remote connection self::getSize($file, $format = ture) // return the size of the file self::formatSize($size, $precision=2) // return the formatted size like 12.34MB self::getByte($size) // return the byte of any formatted size self::copy($source, $dest, $overwrite = false) // copy any file or directory to another path self::del($file) // delete any file or directory self::rename($file, $newname) // rename file or directory $this->save() // save current content to the current file self::saveFile($file, $content='', $mode='wb') // save some content to some file $this->get() // get the content from current file self::getLocal($file, $length=0, $offset=0) // get the content from the local file self::getRemote($url, $header, $method, $data, $timeout) // get the content from the remote file self::getRemote_curl($url, $data='', $header=array()) // get the content from the remote file self::show($content) // content output self::find($filter='', $dir='./', $recursive=false) // return a list of the specified files for specified directory self::getRemoteFile($remote_file, $local_file) // get remote file to local self::judgeChild($dir, $only_dir = true) // To judge is there any file or subdirectory in a diretory self::getTree($dir='./') // Get the info of the files in some directory self::removeBom($str) // remove the bom of utf-8 file content self::rewritable($file) // Check if a file or directory is rewritable
图形处理 $myImg = new myImg($width, $height, $cr) // 构造函数 $myImg->create($trueImage, $background) // 生成画板 $myImg->setTile($image, $point, $width, $height) // 设置区域贴图 $myImg->setTransparent($color) // 设置透明色(可为点、索引色和数组色) $myImg->randomColor($rand) // 随机颜色 $myImg->load($image, &$data) // 读取图片文件,并返回图片信息 $myImg->rotate($angle, $img) // 旋转画布 $myImg->resize($rate, $return, $img) // 按比例缩放画布(可选择返回图像源) $myImg->crop($point, $width, $height, $img, $return) // 截取画布的一部分(可选择返回图像源) $myImg->paste($img, $point, $alpha, $gray) // 将一图像源粘贴到画布的某一位置 $myImg->setLine($thickness, $style, $brush) // 设定画线的粗细、风格、笔刷 $myImg->setFilter($filtertype, $img, $arg) // 为图像添加滤镜效果 $myImg->getSize($img) // 返回图像源的宽、高 $myImg->getColor($point, $mode) // 取得画布某点的颜色 $myImg->setColor($idx) // 设置颜色 $myImg->checkPoint() // 检测点的有效性 $myImg->check() // 检测图像源的有效性 $myImg->fill($point, $color, $color_border) // 从一点向画布右下填充 $myImg->drawLine($p_start, $p_end, $color) // 画线 $myImg->drawRectangle($point, $width, $height, $color_line, $color_fill) // 画矩形 $myImg->drawPolygon($points, $color_line, $color_fill) // 画多边形 $myImg->drawFiveSidedStar($point, $radius, $color_line, $color_fill, $star, $spiky) // 画五角星 $myImg->drawEllipse($point, $width, $height, $color, $fill) // 画椭圆 $myImg->drawArc($point, $width, $height, $arc, $color, $fill) // 画椭圆弧 $myImg->drawPie($data, $point, $width, $height, $mask, $ext_value, $distance, $start_angle) // 画饼图 $myImg->drawZigzag($points, $color_line) // 画折线 $myImg->drawString($text, $point, $color, $font, $font_size, $angle) // 添加文字 $myImg->setFont($font) // 设置字体 $myImg->getFontSize($text, $size, $angle) // 取得字符串的占位大小 $myImg->addNoise($number) // 添加干扰点 $myImg->make($type, $file, $img) // 输出图像源到浏览器或文件 $myImg->destroy($img) // 释放图像源 $myImg->transString($str) // 字符集转换 $myImg->gif_info($filename) // 读取GIF信息 $myImg->captcha($str, $font, $fontsize) // 生成验证码 $myImg->watermark($watermark, $position, $img_dst, $para) // 添加图片水印 $myImg->thumb($dstW, $dstH, $img_dst) // 制作缩略图
生成js或css的压缩代码
文件打包: $mypacker = new myPacker($pack_dir, $pack_file) // Set the Class $mypacker->addIgnore() // add files which will not be packed $mypacker->pack() or $mypacker->unpack() // pack or unpack file(s)
获取类、函数及扩展信息 $this->init($para) $this->info() $this->export() $this->new() $this->getName($mode) $this->getVariants() $this->getFunc($method) $this->getComment($method) $this->is($type) $this->check($name, $type)
服务器响应及提交信息处理 self::init($cookie_opt, $session_opt) // Set the Request Object self::check($idx) // Check the variables (POST, GET, FILE, COOKIE, SESSION) self::getValue($type, $para) // Get any variables (GLOBAL, GET, SERVER, COOKIE, etc.) self::get($para) // Get variable from query string self::post($para) // Get variable from post data self::request($para) // Get variable from _REQUEST self::server($para) // Get variable from _SERVER self::env($para) // Get variable from _ENV self::globals($para) // Get or Set variable for GLOBAL self::ip() // Get Client IP self::ping('ip:port') // Check if it's open of any IP on one specified port self::pingURL($url) // Get the request time of some url self::setCookieOpt($setting) // Set cookie settings self::setCookie($name, $value, $expire, $path, $domain, $httponly) // Set a cookie self::setCookie_nopre($name, $value, $expire, $path, $domain, $httponly) // Set a cookie without prefix self::removeCookie($name, $pre) // Remove a cookie self::cookie($para) // Get variable from _COOKIE self::setSessionOpt($setting) // Set session settings self::sessionStart($handle) // Start the session and set the handle functions self::sessionRestart($handle) // Restart Session self::sessionEnd() // Destroy Session self::session($para) // Get a session value or Get all session data with a encode string self::removeSession($key) // Unset a session item self::setSessions($data) // Decode and batch set sessions from a encode string self::sessionId() // Get the current session id self::setSessionPath($path) // Get or set the current session save path self::setSessionName($name) // Get or set the current session name self::sessionEncode($array) // Encode an array parameter to session string self::sessionDecode($array) // Decode a session string
网站路由处理 $router = new myRouter(); $router->format('hex', '[a-fA-F0-9]+'); $router->rule('/test/[any]/[str]/[hex]/[yyy]/[int]', function() {var_dump(func_get_args());}); $router->check('/test/哈哈/string/aB123f/yyy/123456'); $router->parseQuery()
核心框架类,扩展于myController self::getInstance($calledClass) // 取得类实例 $this->start() // 框架执行入口,初始化所有变量 $this->setInstance() // 声明重要实例 $this->show(myTemplate $tpl) // 通过模板类显示页面 $this->render(myTemplate $tpl) // 通过模板类输出页面内容 $this->checkCache(myTemplate $tpl) // 检查是否存在缓存并输出 $this->end() // 框架终止,销毁相关变量 $this->gzOut($level, $query, $time) // 压缩输出页面内容 $this->addCSS($file) // 添加页面CSS文件 $this->CSS($cache) // 生成整合CSS文件 $this->addJS($file) // 添加页面脚本文件 $this->JS($cache) // 整合页面脚本文件 $this->editorSetPlugin($code, $btn) // 富文本编辑器功能扩展 $this->editorGetPlugin() // 生成编辑器插件缓存脚本 self::checkClose() // 检测框架服务是否关闭 self::info($msg, $url) // 信息提示,需先声明mystep类 self::captcha($len, $scope) // 生成验证码 self::language($app_name, $type) // JS语言包接口 self::setting($app_name, $type) // JS设置信息接口 self::api($para) // 框架API执行接口 self::module($m) // 框架模块调用接口 self::appFunc($func) // 应用自定义功能接口(sitemap, atom, rss等) self::upload() // 文件上传接口 self::download($idx) // 文件下载接口 self::remove_ul($idx) // 删除文件下载接口 self::setURL() // 链接处理 self::redirect() // 链接跳转 self::init() // 框架变量初始化 self::go() // 执行框架 self::setPara() // 应用模块初始化参数设置 self::getModule($m) // 应用模块调用 self::vendor($class_name) // 调用第三方组件 self::segment($str) // 字符串分词
各类字符串类函数 $this->__get // return the value of any public variant or from the info variant $this->__toString // return the value of string $this->set($val) // set the value of string $this->get($charset='') // return the value of string self::charset($str) // return the charset of the string self::setCharset($str, $charset='UTF-8') // change the charset of the string self::toHex($str) // change the string to hex code self::fromHex($hex) // get string from hex code self::toJson($var, $charset='UTF-8') // get json string from any array self::fromJson($json, $assoc = false) // get array from string self::fromAny($var) // transfer any variant to string self::toXML($var, $item_tag, $main_tag) // get xml string from any array self::toScript($var, $name) // get php code from any variant self::htmlTrans($str) // transfer the html code to show self::txt2html($content) // transfer the text code to html self::breakStr($string) // break a string into chars self::fileCharset($file_src, $file_dst, $charset) // change a file to anyother charset self::substr($string, $start, $length, $mode) // get a part of same string self::rndKey($length, $scope, $charset) // get a random string self::addSlash(&$str) // add slashes to string self::stripSlash(&$str) // remove slashes to string self::watermark($html, $rate, $scope, $str_append, $charset, $class_nam, $tag_name, $jam_tag) // insert jam string to html code
模版解析: $tpl->init($setting, $cache, $allow_script) // Set the Template Class $tpl->setTplPara($setting) // Set the parameter of templatee $tpl->setCacheMode($cache) // Set the mode of template cache $tpl->getTemplate($file1, $file2) // Get template content $tpl->setLoop($key, $value, $fullset) // Set values for loop-blocks (in turn or batch) $tpl->setIf($key, $value) // Set the judging conditions for if-blocks $tpl->setSwitch($key, $value) // Set the switch conditions for switch-blocks $tpl->assign($name, $value) // Set value for one variable $tpl->loadSet($file, $prefix) // Read Batch setting file $tpl->removeCache() // Remove template complied cache $tpl->regTag($tag_name, $tag_func) // Regist tag-parser for the custom tags $tpl->getBlock($tpl_content, $tag, $idx) // Analysis a custom tag $tpl->checkCache() // Check if the current template with the define idx has been cached as a static html file $tpl->getCache() // Directly get file content from cached html file $tpl->render($global_vars) // Get result content compile by the template engine ('$global_vars' ara the parameters needed in php cache file)
文件上传处理: $upload = new myUploader($path, $rename, $banlst); $upload->do(); That's all...
压缩文件处理 $zip = new myZip($zip_file); $zip->zip($file); $zip->unzip($dir);
MySQL查询类 $mysql->init($host, $user, $pass, $charse) // Set the Database Class $mysql->connect($pconnect) // Build a Connection to MySQL to $mysql->DB_conn $mysql->reconnect($pconnect) // Rebuild a Connection to MySQL to $mysql->DB_conn $mysql->selectDB($the_db) // Select a Database of MySQL to $mysql->DB_select (Must Build Connect First) $mysql->setCharset($charset) // Set Charset for the database connection $mysql->changUser($user, $pass, $db) // Change the Database User (Unusable in some versoin of MySQL) $mysql->query($sql) // Execute a Query of MySQL, Result into $mysql->DB_resut $mysql->getRS() // Return The Current Result as an Array and Set the Point of Result to the Next Result $mysql->record() // Get the first line of the record set $mysql->records() // Get the all of the lines of the query $mysql->result() // Get the single value of the query with the parameters of buildSel function $mysql->count($sql) // Count the result number of current query $mysql->getData($line, $field) // Get specified field or line of a query $mysql->GetFields($the_db, $the_tbl) // Get the Columns List of a Table as an Array $mysql->getCreateScript($the_tbl, $the_db) // Get the Whole structure of Current Selected Database as an Array $mysql->getDataScript($the_tbl, $the_db) // Get All of The Data of a Table $mysql->getIdxScript($the_tbl, $the_db) // Get the Indexes List of a Table as an Array $mysql->getDBs() // Get the Databases List of Current MySQL Server as an Array $mysql->getTbls($the_db) // Get the Tables List of Current Selected Database as an Array $mysql->getPri($the_tbl, $the_db) // Get the Primary Keys of a Table as an Array $mysql->getInsertId() // Return auto increment id generate by insert query $mysql->optTabs() // Optimize the Tables of Selected Database $mysql->getStat() // Get the Current Status of MySQL $mysql->getProcesses($mode, $time_limit) // Get the processes list of MySQL $mysql->create($name, $para, $type) // Create Object $mysql->drop($name, $para, $type) // Drop Object $mysql->select() // Build a select query use the SQL builder and execute it $mysql->update() // Build a replace query use the SQL builder and execute it $mysql->delete() // Build a delete query use the SQL builder and execute it $mysql->replace() // Build a replace query use the SQL builder and execute it $mysql->batchExec($SQLs) // Execute Multi Query from an Array (Use HandleSQL First) $mysql->handleSQL($strSQL) // Split the SQL Query String into a array from a whole String (Maybe Read from a File) $mysql->file($file) // Read SQL File and execute it $mysql->check($obj, $type) // Check if a db object works $mysql->free() // Free the $mysql->DB_result in order to Release the System Resource $mysql->close(&$err_info) // Close Current MySQL Link $mysql->checkError() // Check if error occured $mysql->clearError() // Clear Errors Information $mysql->error($str) // Handle the Errors
获取汉字拼音及缩写 $pinyin = pinyin($str, &$abbr) Modified by windy2000
简单数据库 $db = new simpleDB($name, $path, $tlen) // Set the Text DB Class $db->connect($mode) // Connect with the text db with the specified mode (read, write or append) $db->selectDB($name, $path, $tlen) // Set working db to another one $db->lock($mode) // Lock/unlock current working db $db->write($content, $offse) // Update the content of the working db $db->get($file, $length, $offset) // Get a content part of the db file $db->check() // check if the working db can be used $db->close() // Close current db $db->create($setting) // Create text DB file in the specified directory $db->destory() // delete db $db->empty() // truncate db $db->insert($data, $mode) // insert data to db $db->update($data, $row, $mode) // update db data $db->query($condition, $single) // query data with some condition $db->select($condition, $single) // query data with some condition $db->delete($row) // delete data in some row $db->record($row) // query one record from some row $db->records() // query all data from db $db->random($rows) // query random record from db $db->getData($line, $field) // get a field value from a specified line $db->result($condition, $field) // get a field value with the specified condition $db->getFields() // get current db settings $db->setOrder($result, $col, $asc) // order the result record set