A summary of the facts that are not explained in the ThinkPHPV2.2 documentation,_PHP Tutorial
A summary of those things that are not explained in the ThinkPHP V2.2 documentation, This article describes those things that are not explained in the ThinkPHP V2.2 documentation. Share it with everyone for your reference. The specific analysis is as follows: The following is a summary of the content that is not mentioned and explained in detail in the documentation: (continuously updated in the future) 1. Set APP_DEBUG to true in the configuration file. When entering the debug mode, the page will not display trace information by default. Solution: ‘SHOW_PAGE_TRACE’=>true Add this. 2. The success method in the action only needs to store two parameters success($message, $ajax=false), and the called page will be displayed even if it is not written. Solution: Add: to the configuration file ‘TMPL_ACTION_SUCCESS’ => ‘Public:success’ (error jump: ‘TMPL_ACTION_ERROR’ => ‘Public:success’) In fact, the default settings in version 2.2 are as follows: ‘TMPL_ACTION_ERROR’ => THINK_PATH.’/Tpl/dispatch_jump.html’. 3. Use ordinary tags to load template engines and ignore them directly. Solution: none (haven’t found the reason yet) 4. __ROOT__ input in the template will only be a null character, and you cannot use the __ROOT__ address to return to the home page after the page jumps. Solution: Modify __ROOT__ by…
The method of automatically assigning paths when uploading files in PHP,_PHP Tutorial
The method of automatically assigning paths when PHP uploads files, The example in this article describes the method of automatically assigning paths when PHP uploads files. Share it with everyone for your reference. The specific analysis is as follows: When uploading files on the website, if it is a small enterprise website, it is not a problem to put them in one directory. When the website becomes larger and there are too many uploaded files, we cannot put them in the same directory. Here we will talk about it A method to automatically assign paths to uploaded files with PHP. PHP distribution path example of uploaded files The main program fragment is as follows: The code is as follows: <?php /* Digitally assign path */ function allotPath($id, $extend=’jpg’) { $folders = str_split(sprintf(“%012s”, $id),3); $folders[3] = $id; return ‘/’.join(‘/’, $folders).’.’.$extend; } /*Allocate paths in hash mode*/ function allotHashPath($id, $extend=’jpg’) { $folders = array_slice( str_split(md5($id),2), 0, 4); $folders[] = $id; return ‘/’.join(‘/’, $folders).’.’.$extend; } var_dump(allotPath(122333)); // string(23) “/000/000/122/122333.jpg” var_dump(allotHashPath(122333)); // string(23) “/9c/7c/c2/cd/122333.jpg” Here we are mainly talking about the distribution of paths in the number method and the distribution method of the hash method. We can also distribute according to the date.…
PHP5.3 installation ZendGuardLoader graphic tutorial,_PHP Tutorial
PHP5.3 installation Zend Guard Loader graphic tutorial, Zend Optimizer/3.3.3 Decryption and encryption code optimization, improve the execution speed of PHP applications, and significantly reduce the CPU load of the server. Zend Guard Loader/5.5.0/6.0 decrypts and encrypts code optimization, improves the execution speed of PHP applications, and significantly reduces the CPU load of the server. Zend Optimizer has been officially replaced by Zend Guard Loader since PHP 5.3.X. Installation methods vary, here is how to install Zend Guard Loader: Download address: ZendGuardLoader-php-5.3-Windows.zip After downloading, unzip the compressed package, find the ZendLoader.dll file in the ZendGuardLoader-php-5.3-Windows\ZendServer\lib\loader\php-5.3.x directory, and put it in your php directory under ext: Then edit the php.ini file and add a piece of code (such as): [Zend. loader] zend_loader.enable=1 zend_loader.disable_licensing=1 zend_loader.obfuscation_level_support=3 zend_loader.license_path= zend_extension=”D:\php\ext\ZendLoader.dll” Save the php.ini configuration file, restart apache or IIS Create a new phpinfo() file in the www directory you specified. Enter If the probe shows Zend Guard Loader, it means that Zend Guard has been configured successfully; Attachment: php5.3 does not support the ZendOptimizer solution (Zend Guard Loader) Under PHP 5.3, Zend Optimizer has been replaced by the new Zend Guard Loader 1. Download the Zend Guard Loader zip file. (Official download address: http://www.zend.com/en/products/guard/downloads) 2. Unzip…