Value of the thinkphp model call Field

Source: Internet
Author: User
When the thinkphp model is used for automatic completion, How can I obtain the field value just generated in the model. {Code...} Please be confused. Thank you. When the thinkphp model is used for automatic completion, How can I obtain the field value just generated in the model.

// Automatically complete protected $ _ auto = array ('rand', 'rand', self: MODEL_INSERT, 'function '), // The random number array ('Password', 'enabled', self: MODEL_INSERT, 'callback'), array ('login', 'time', 3, 'function'), // when updating the login Field, write the current timestamp array ('IP', 'Get _ client_ip ', 3, 'function '), // automatically obtain the ip address when updating the ip field); function encrypt ($ data) {// how can I call the rand random number echo 'rand random number 'Here ';}

Please try again. Thank you.

Reply content:

When the thinkphp model is used for automatic completion, How can I obtain the field value just generated in the model.

// Automatically complete protected $ _ auto = array ('rand', 'rand', self: MODEL_INSERT, 'function '), // The random number array ('Password', 'enabled', self: MODEL_INSERT, 'callback'), array ('login', 'time', 3, 'function'), // when updating the login Field, write the current timestamp array ('IP', 'Get _ client_ip ', 3, 'function '), // automatically obtain the ip address when updating the ip field); function encrypt ($ data) {// how can I call the rand random number echo 'rand random number 'Here ';}

Please try again. Thank you.

Object-oriented:

$ User = D ("User"); // instantiate the User object $ User-> create (); // generate the data object echo $ User-> rand; // obtain rand

I ('Post. rand')? Have you tried it?

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.