Questions about the return value of the F method inside the TP frame

Source: Internet
Author: User
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
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.