简单或比较不起作用,undefined function()?

时间:2010-08-11 20:50:35

标签: php

我收到此错误:

  

致命错误:调用未定义   function()in   /home/gmfeedsc/domains/cekdahl.com/public_html/virek/system/application/views/rekommendationer/visa.php   在第263行

那一行是:

<?php if ( ($post['users_id'] == $this->userId) || ($this->userLevel > 0) ): ?>

我无法弄明白。我想这是因为围绕比较思考()是一个函数,但我怎么能写这个呢?感谢。

编辑: 我的脚本是Codeigniter视图,周围的代码只是XHTML。由于练习要求我不应该通过$ this-&gt;检索变量;在视图中,我改为使用变量,代码现在看起来像这样:

<?php if ( ($post['users_id'] == $userId) || ($userLevel > 0) ): ?>

这些陈述是独立工作的,当我把它们放在一起时会出现问题。

2 个答案:

答案 0 :(得分:0)

可能是因为你没有     在您的条件(XHTML)操作之后<?php endif; ?>

(见the PHP manual page。)

答案 1 :(得分:0)

此代码没有任何问题。但是,请尝试这样写:

if ($post['users_id'] == $userId or $userLevel > 0)

如果您仍有问题,请尝试使用嵌套ifs查看是否得到相同的结果:

if ($post['user_id'] == $userId) {
    if ($userLevel > 0) {