search

Home  >  Q&A  >  body text

smarty turns on caching garbled characters

After smarty turns on the cache, the page will be garbled for the first time, and then it will be normal. The project and the page are all utf8 encoded, so I don’t know about the *** issue.

The PHP code is as follows (smarty3.1.16)

<?php

include_once './libs/Smarty.class.php';

$ smarty = new Smarty();

$smarty->caching =1;

$smarty->cache_lifetime =3 ;

$smarty->assign( "name","Everything goes well");

$smarty->display("name.html");


##template

<!DOCTYPE html>

<html>

<head>

<meta charset="UTF-8">

<title>Insert title here</title>

</head>

<body>

{$name}

</body>

</html>


风起时丶丶想你风起时丶丶想你2235 days ago936

reply all(2)I'll reply

  • 风起时丶丶想你

    风起时丶丶想你2018-10-12 11:21:46

    After changing the php version, I found that it was caused by php6 itself. I don’t know what caused it specifically. Anyway, try to use php5 or 7 instead of 6.

    reply
    0
  • 风起时丶丶想你

    风起时丶丶想你2018-10-11 10:33:47

    Can anyone explain it?

    reply
    0
  • Cancelreply