Php Can';t在写上下文中使用方法返回值;不知道从这里到哪里去

Php Can';t在写上下文中使用方法返回值;不知道从这里到哪里去,php,mysql,Php,Mysql,可能重复: 这是变量的源代码 <?php if ($admin->get_permissions()=3) echo 'Welcome to the Admin Panel'; else echo 'Sorry, You do not have access to this page'; ?> 这应该是一种通过使用elseif语句来调用授权用户访问的我的页面的简单方法。或者我是这么想的== if ($admin->get_permissions() == 3) 你需

可能重复:

这是变量的源代码

<?php
if ($admin->get_permissions()=3)
echo 'Welcome to the Admin Panel';
else
echo 'Sorry, You do not have access to this page';
?>

这应该是一种通过使用elseif语句来调用授权用户访问的我的页面的简单方法。或者我是这么想的<代码>==

if ($admin->get_permissions() == 3)
你需要改变

$admin->get_permissions()=3


=
是赋值运算符,
=
是相等比较运算符。解析器告诉您不能将
3
赋值给函数的结果。这样做没有任何意义。

请随意拍打俯瞰者。尴尬的
$admin->get_permissions()=3
$admin->get_permissions()==3