<?php defined(‘IN_PHPCMS‘) or exit(‘No permission resources.‘); pc_base::load_app_func(‘global‘); class index{ private $db; private $content_db; private $order_db; public function __construct(){ } /** * 处理,填写订单信息 */ public function init(){ new_addslashes(new_html_special_chars($_POST)); extract($_POST[‘info‘]); $this->content_db=pc_base::load_model(‘content_model‘); $this->content_db->set_model($modelid); $line_data=$this->content_db->get_content($catid,$line_id); //print_r($line_data); $prices=string2array($line_data[‘price‘]); if ($is_group == 1){ foreach ($prices as $key =>$val){ if ($val[‘title‘] == $line_type){ $price_group=$prices[$key]; } } unset($prices); $prices[0]=$price_group; } $order_sn=get_order_sn(); include template(‘order‘,‘index‘); } /** * 处理,确认订单信息 */ public function confirm_order(){ new_addslashes(new_html_special_chars($_POST)); extract($_POST[‘info‘]); include template(‘order‘,‘confirm_order‘); } /** * 保存订单 */ public function save_order(){ new_addslashes(new_html_special_chars($_POST)); $this->order_db = pc_base::load_model(‘order_model‘); //加载模型并且实例化 $this->db = pc_base::load_model(‘order_model‘); //加载模型并且实例化 ReflectionObject::export($this->order_db); //反射输出的是一样的 ReflectionObject::export($this->db); //同上 var_dump(method_exists($this->db, ‘add_order‘)); //true var_dump(is_callable(array($this->order_db, ‘add_order‘))); //true var_dump(method_exists($this->order_db, ‘add_order‘)); //true var_dump(is_callable(array($this->db, ‘add_order‘))); //true $this->db->add_order(); //可以调用 $this->order_db—>add_order(); //不可以调用,致命错误 Fatal error: Call to undefined function add_order() in /var/www/html/line/phpcms/modules/order/index.php on line 56 include template(‘order‘,‘save_order‘); } }
时间: 2024-09-15 02:18:24