Frontend to backend ThinkPHP development site (5) and backend thinkphp
Today is Friday, and this project has been completed for five nights. You don't have to go to work tomorrow weekend to end the project all day. The background interface will be provided tonight.
The entire background interface is like this. The next step is to move bricks. Fill in menu functions one by one.
There are also multiple public methods added to prepare for subsequent menu development.
<? Php/*** return JSON data */function jsonResult ($ status, $ message, $ data) {$ result = array ('status' => $ status, 'message' => $ message, 'data' => $ data); exit (json_encode ($ result ));} /*** MD5 encryption password */function getMd5Password ($ password) {return md5 ($ password. C ('md5 _ pre');}/*** get navigation menu */function getMenuType ($ type) {return $ type = 1? 'Background menu ': 'frontend navigator';}/*** get status */function status ($ status) {if ($ status = 0) {$ str = 'offset';} elseif ($ status = 1) {$ str = 'normal';} elseif ($ status =-1) {$ str = 'delete';} return $ str;}/*** obtain the background menu URL */function getAdminMenuUrl ($ nav) {$ url = '/admin. php? C = '. $ nav ['C']. '& a = '. $ nav ['a']; if ($ nav ['F'] = 'index') {$ url = "/admin. php? C = ". $ nav ['C'];} return $ url;}/*** get controller */function getActive ($ nav_controller) {$ controller = strtolower (CONTROLLER_NAME ); if (strtolower ($ nav_controller) ==$ controller) {return 'class = "active" ';} return '';} /*** File Upload result returned */function showKind ($ status, $ data) {header ('content-type: application/json; charset = UTF-8 '); if ($ status = 0) {exit (json_encode (array ('error' => 0, 'url' => $ data )));} exit (json_encode (array ('error' => 1, 'mes Sage '=> 'upload failed');}/*** get logon username */function getLoginUsername () {return $ _ SESSION ['adminuser'] ['username']? $ _ SESSION ['adminuser'] ['username']: '';}/*** obtain the menu name */function getCatName ($ navs, $ id) {foreach ($ navs as $ nav) {$ navList [$ nav ['menu _ id'] = $ nav ['name'];} return isset ($ navList [$ id])? $ NavList [$ id]: '';} function getCopyFromById ($ id) {$ copyFrom = C (" COPY_FORM "); return $ copyFrom [$ id]? $ CopyFrom [$ id]: '';} function isThumb ($ thumb) {if ($ thumb) {return '<span style =" color: red "> Yes </span> ';} return 'none';}/*** capture preview */function msubstr ($ str, $ start = 0, $ length, $ charset = 'utf-8', $ suffix = true) {$ len = strlen ($ str); if (function_exists ('mb _ substr ')) {if ($ suffix) {return mb_substr ($ str, $ start, $ length, $ charset ). '... ';} else {return mb_substr ($ str, $ start, $ length, $ charset) ;}} elseif (function_exists ('iconv _ substr ')) {If ($ suffix & $ len> $ length) {return mb_substr ($ str, $ start, $ length, $ charset ). '... ';} else {return mb_substr ($ str, $ start, $ length, $ charset );}} $ re ['utf-8'] = "/[\ x01-\ x7f] | [\ xc2-\ xdf] [\ x80-\ xbf] | [\ xe0 -\ xef] [\ x80-\ xbf] {2} | [\ xf0-\ xff] [\ x80-\ xbf] {3 }/"; $ re ['gb2312'] = "/[\ x01-\ x7f] | [\ xb0-\ xf7] [\ xa0-\ xfe]/"; $ re ['gbk'] = "/[\ x01-\ x7f] | [\ x81-\ xfe] [\ x40-\ xfe]/"; $ re ['big5'] = "/[\ x01-\ x7f] | [\ x81-\ xfe] ([\ x40-\ x7 E] | \ xa1-\ xfe])/"; preg_match_all ($ re [$ charset], $ str, $ match); $ slice = join ("", array_slice ($ match [0], $ start, $ length); if ($ suffix) {return $ slice. '... ';} return $ slice;}?>
Now, get up early tomorrow and get the project up!
Source Code address: https://github.com/YoZiLin/TP-CMS