Questions about the return value of the F method inside the TP frame
The code is actually very simple, I read the data from the database and then use the F method to cache to the file, the file is established also has the data write, but the F method returns is null, the solution is baffled.
Public Function Updatecache () {
$db = M (' category ');
$data = $db->select ();
$f = f (' data ', $data)
Var_dump ($f);//////output is null
}
In fact, I just want to use the return value of the F method to make a judgment on my cache success ... This is my purpose ... But I've been looking for a long question and I don't know why the F method returns null.
------Solution--------------------
The F function reads the cache and returns the data, and the write cache returns null, of course.
Want data? $data = F (' data ');
------Solution--------------------
You can just go back to $value.
But there may be a lot of content in $value, and you don't need
So returning can also return! Empty ($value);
Since it is a write cache, then $value represents what is written.
Non-NULL indicates success
Anyway, what to return depends on the algorithm you already have.
TP is just a tool that will allow him to adapt to you, not you to indulge him