For questions about smarty, please advise !! Thank you !! Thank you for your advice! Thank you !!! The first time I got in touch with smarty, I reported an error when I used it for the first time. the browser showed the following: However, when I refreshed the prompt information, the browser still did not output anything! StrictStandards: strftime () [function. strf for questions about smarty, please give me some advice !! Thank you !!
Thank you for your advice! Thank you !!!
The first time I got in touch with smarty, I reported an error when I used it for the first time. the browser showed the following: However, when I refreshed the prompt information, the browser still did not output anything!
Strict Standards: strftime () [function. strftime]: It is not safe to rely
On the system's timezone settings. Please use the date. timezone setting,
The TZ environment variable or the date_default_timezone_set () function.
In case you used any of those methods and you are still getting this
Warning, you most likely misspelled the timezone identifier. We selected
'Utc' for '8. 0/no DST 'instead in
C: \ AppServ \ www \ smarty \ Smarty \ Smarty_Compiler.class.php on line 400
The configuration is as follows:
Smarty_inc.php
Include_once ("Smarty/Smarty. class. php"); // contains the smarty class file
$ Smarty = new Smarty (); // Create a smarty instance object $ smarty
$ Smarty-> config_dir = "Smarty/Config_File.class.php"; // Directory variable
$ Smarty-> caching = false; // whether to use the cache. during project debugging, it is not recommended to enable the cache.
$ Smarty-> template_dir = "./templates"; // set the template directory
$ Smarty-> compile_dir = "./templates_c"; // Set the compilation Directory
$ Smarty-> cache_dir = "./smarty_cache"; // cache folder
//----------------------------------------------------
// Left and right boundary characters. the default value is {}, but it is easy to conflict with JavaScript in actual application.
//----------------------------------------------------
$ Smarty-> left_delimiter = "<{";
$ Smarty-> right_delimiter = "}> ";
?>
Index. php
Include ("Smarty_inc.php ");
$ Name = "initial smarty ";
$ Smarty-> assign ("title", $ naem );
$ Smarty-> display ("index.html ");
?>
Index.html
<{$ Title}>
------ Solution --------------------
No timezone is set. modify the opened php. ini file
Date. timezone = Asia/Shanghai, and then restart webserver
------ Solution --------------------
This is because the default time zone is not set. add the following at the beginning of the PHP file:
PHP code
Date_default_timezone_set ('prc ');
------ Solution --------------------
Or
PHP code
------ Solution --------------------
This is not a smarty error, but your php environment is not properly configured.
Set the time zone for date. timezone in php. ini
Or set the time zone using the date_default_timezone_set function in the program.