Regarding the issue of turning on automatic timestamps and template output time conversion.
善為
善為 2019-05-20 10:44:20
0
2
1184

Hello, teachers and classmates.

During development, automatic timestamps were turned on. During template output, it was found that conventional automatic timestamp conversion failed.

Later put it in the database.

'datetime_format' => 'Y-m-d H:i:s', after changing this option to false, the normal conversion in the template still fails.

Please tell me how to output correctly.

善為
善為

reply all(2)
善為

Due to the rules of the framework, the timestamp writing function is automatically enabled. You need to get the timestamp through the getter in the model, and then format the time in the getter. Just call this field directly when calling it in the template.

Use the getter in the model to get it. Format and return.

QQ截图20190520170000.png


Directly output in the template

QQ截图20190520170054.png


Note: Turn on automatic timestamp writing. Generally, the timestamp written through the model method can take effect normally. When reading, data is also obtained through the model. The time displayed on the front desk can be converted normally.

33.png

殘留の回憶

Write directly in native form, <?php date('Y-m-d H:i:s',time());?>

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!