Home  >  Article  >  Backend Development  >  Smarty installation and configuration method_PHP tutorial

Smarty installation and configuration method_PHP tutorial

WBOY
WBOYOriginal
2016-07-21 15:52:44831browse

Download the latest Smarty: http://smarty.php.net/
The latest version: 2.6.18
After unzipping, rename the libs directory in the directory to smarty, copy it to your website directory, and at the same time Create two directories, templates and templates_c, in the root directory of the website
Create test.php with the following content:
include_once('./Smarty/Smarty.class.php');$smarty = new Smarty();
$smarty -> template_dir = "./templates"; //Template storage directory
$smarty -> compile_dir = "./templates_c"; //Compilation directory
$ smarty -> left_delimiter = "{{"; //Left delimiter
$smarty -> right_delimiter = "}}"; //Right delimiter
$smarty -> assign('test ','OK');
$smarty -> display('test.html');
?>
Give templates_c permission 755

Create a new test in the templates directory. html:




{{$test}}


Open test.php. If you see OK, it means your smarty installation is successful!

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/318884.htmlTechArticleDownload the latest Smarty: http://smarty.php.net/ The latest version: 2.6.18 after unzipping Rename the libs directory in the directory to smarty, copy it to your website directory, and at the same time in the website root directory...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn