PHP Call empty appears error can ' t use function return value in write context

Source: Internet
Author: User
Tags php website vars

PHP Call empty appears error can ' t use function return value in write context

2012-10-28 09:33:22 | 11,391 Reads | comments:0 Article | itokit

A simple procedure for today:

C + + Code copy content to clipboard
    1. protected function _islogin () {
    2. if (Empty (Cookie (C (' itokit_com ') ))) {
    3. $this->error (' not logged in backstage, please log in first ', ' public/login ');
    4. }
    5. }

Run this method to return the following error:
Can ' t use function return value in write context E:\www\www.itokit.com\js\Lib\Action\Jsadmin\CommonAction.class.php 16th Yes.

The reason for this error is that the empty function argument must be variable and cannot be the return value of other functions, including Str_replace,trim, etc.
And my empty uses a function that the cookie has a return value. So the mistake was reported.
OK, know the cause of the error, modified can be:

PHP Code copy content to clipboard
    1. Protected function _islogin () {
    2. $itokitname = Cookie (C (' jsadmin_user '));
    3. if (emptyempty ($itokitname)) {
    4. $this->error (' not logged in backstage, please log in first ', ' public/login ');
    5. }
    6. }

Well, the problem is solved. How do you encounter a small problem like me, you can get the variable first, and then use empty oh.

Other articles related to PHP usage errors:
1, how to correctly understand the meaning of PHP program error message
2, how to correctly understand the error message PHP
3, Beginners: PHP website Development FAQ Summary

PHP Call empty appears error can ' t use function return value in write context

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.