dongyange1101 2013-06-06 15:03
浏览 39
已采纳

解析错误:语法错误,意外$ end fuelphp [关闭]

I have this error on line 98 i cant found what is the error this is the class that produces the error!

Parse error: syntax error, unexpected $end in /var/zpanel/hostdata/tsalopulos/public_html/tsalopoulos_gr/fuel/app/modules/checkoutv2/classes/handle.php on line 98

<?php

namespace Checkoutv2;

class Handle{

    public static $_items;

    public $product;

    public $image;

    public $price;

    public $location;

    public $totals = array(
        'total' => 0,
        'items' => 0
    );

    public $_user;


    public $items = array ('items' => array());

    public function __construct( $cart_items, $user)
    {
        static::$_items = $cart_items;
        $this->price = new \ProductPrice();
        $this->image = new \ProductImage();

        $this->_user = $user;
    }


    public function boot()
    {
        foreach(static::$_items as $item)
        {
            $this->product = \Model_Product::query()
                ->related('description')
                ->where('description.lang_code','=',\Session::get("lang"))
                ->where('id',$item->get_id())
                ->get_one();

            $description = $this->getProductDescription($this->product->description);

            $this->totals['items'] += $item->get_qty();
            $this->totals['total'] += round(
                    $this->price->getPriceDiscountedInternet(
                        $this->price->getPriceDiscounted(
                            $item->get_price()
                        )
                    ),2) * $item->get_qty();




            $this->items['items'][] = array(
                'rowid'  => $item->get_rowid(),
                'id'     => $item->get_id(),
                'ids'    => $this->product->id_one.' | '.$this->product->id_two,
                'image'  => $this->image->resizeProductImage( $item->get_id() ),
                'description' => $description,
                'title'  => $item->get_name(),
                'qty'    => $item->get_qty(),
                'qty_north' => $this->product->qty_north,
                'qty_south' => $this->product->qty_south,
                'price'  => round(
                    $this->price->getPriceDiscountedInternet(
                        $this->price->getPriceDiscounted(
                            $item->get_price()
                        )
                    ),2),
                'available' => $this->checkQty( $this->product,$item),
                'have' => $this->product->qty,
                'sub_total' =>round(
                    $this->price->getPriceDiscountedInternet(
                        $this->price->getPriceDiscounted(
                            $item->get_price()
                        )
                    ),2) * $item->get_qty(),
            );

        }

        return array(
            'items' => $this->items,
            'total' => $this->totals['total'],
            'total_items' => $this->totals['items']
        );
    }

    public function checkQty($product, $item)
    {
        $local_qty = $this->getLocalQty(); // line 98

        if($product->$local_qty < $item->get_qty())
            return false;
        else
            return true;
    }

    public function getLocalQty()
    {
       $local = $this->checkUserLocation();
       return $local;
    }

    //check user location
    public function checkUserLocation($reverse = false)
    {
        if($reverse){
            if($this->location == 0)
                return 'qty_south';
            else
                return 'qty_north';
        }else{
            if($this->location == 0)
                return 'qty_north';
            else
                return 'qty_south';
        }
    }

    public function prepareUser()
    {
        $this->location = $this->_user->store;
    }


    public function getProductDescription($description)
    {
        foreach($description as $desc){
            return $desc->title;
        }

    }
}
  • 写回答

1条回答 默认 最新

  • dongqian9567 2013-06-06 15:17
    关注

    Your file is fine:

    Nathans-iMac:Desktop nathan$ php -l Untitled.php

    No syntax errors detected in Untitled.php

    Re-upload your file to your web server.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 MATLAB中使用parfor,矩阵Removal的有效索引在parfor循环中受限制
  • ¥20 Win 10 LTSC 1809版本如何无损提升到20H1版本
  • ¥50 win10 LTSC 虚拟键盘不弹出
  • ¥30 关于PHP中POST获取数据的问题
  • ¥30 微信小程序请求失败,网页能正常带锁访问
  • ¥15 Python实现hog特征图可视化
  • ¥30 德飞莱51单片机实现C4炸弹
  • ¥50 CrossLink-LIF-MD6000 型 FPGA 的 CMOS 转 MIPI D-PHY IP 核功能使用异常
  • ¥15 proteus控制16x16LED点阵显示屏的设计
  • ¥30 求会做山景bp1048b2程序的。做直播声卡用