Today comes a big and tricky question-after updating the Smarty template, the page is white, but in the pre-release environment, there's no such thing as a test! Finally, the reason is found to be related to the Smarty template compiling principle.
Write a simple smarty page, run to view the template's compilation directory, and find the corresponding compilation file.
Decodeproperties (Array (' file_dependency ' = = Array (' 177DFB3E2809E44A1FF3A49D04E73219944E3FEF ' = > Array ( 0 = ' tpl\\test.htm ', 1 = 1458725943, #注意到这个值1458725943为2016/3/23 17:39:03 2 = ' file ', ),......... ' Has_nocache_code ' = False,), false); /*/%%smartyheadercode%%*/?>
What happens if I adjust this value to a future time (2016/3/23 23:16:5) and modify the template file? You can see that even if we modify the template, the page is unchanged, that is, the Smarty template is not recompiled. So what does 1458725943 mean by this time? This time, is the modification time of the template file. In summary, if your updated template file is modified earlier than the pre-overwrite template, then Smarty will not recompile (the development environment will cause this problem if the system time is incorrect).
However, the problematic Smarty template was developed by the same developer, and it was also possible to verify that the new version of the template file was modified in the correct time, which led to white screen. Later, also finally found out the reason-because the file upload process, the modification time of the file is the current time of the server, resulting in Smarty compiled incomplete template files, resulting in the white screen. When the template file is uploaded, the modified time of the file becomes the actual modification time, and Smarty is no longer compiled.
Before uploading the Smarty template has not encountered this problem, but the high-volume server, the probability of the problem will also increase.
Solution:
After you update the template file, you need to empty the Smarty compilation directory.
The above describes the php-smarty caused by white screen failure, including the aspects of the content, I hope that the PHP tutorial interested in a friend helpful.