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
- protected function _islogin () {
- if (Empty (Cookie (C (' itokit_com ') ))) {
- $this->error (' not logged in backstage, please log in first ', ' public/login ');
- }
- }
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
- Protected function _islogin () {
- $itokitname = Cookie (C (' jsadmin_user '));
- if (emptyempty ($itokitname)) {
- $this->error (' not logged in backstage, please log in first ', ' public/login ');
- }
- }
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