我在index.php中包含多个文件
include($_SERVER['DOCUMENT_ROOT'].'include/feedback.php');
include($_SERVER['DOCUMENT_ROOT'].'include/order.php');
include($_SERVER['DOCUMENT_ROOT'].'include/customer.php');
然后尝试从order.php调用函数,例如:
$order = order::find_open_orders_by_amount($db, 10);
if (count($order) > 0) {
for ($i = 0; $i < count($order); $i++) {
但代码在order :: find_open_orders_by_amount
之后停止运行我也尝试过包含像
这样的文件include(dirname(__FILE__).'/../include/order.php');
在这两种情况下代码都停止在同一行中执行。有什么建议吗?
order.php
<?php
class order {
private $id;
private $created;
private $changes;
private $finished;
private $status;
private $priority;
private $resposible;
private $changed_by;
private $billed;
private $paid;
private $customer_id;
private $description;
public function getId() {
return $this->id;
}
public function getCreated() {
return order::format_date($this->created);
}
public function getChanged() {
return order::format_date($this->changed);
}
public function getFinished() {
return order::format_date($this->finished);
}
public function getStatus() {
return $this->status;
}
public function getPriority() {
return $this->priority;
}
public function getResponsible() {
return $this->resposible;
}
public function getBilled() {
return $this->billed;
}
public function getPaid() {
return $this->paid;
}
public function getCustomerId() {
return $this->customer_id;
}
public function getDescription() {
return $this->description;
}
function order($id, $created, $changed, $finished, $status, $priority, $resposible,
$billed, $paid, $customer_id, $description) {
$this->id = $id;
$this->created = $created;
$this->changed = $changed;
$this->finished = $finished;
$this->status = $status;
$this->priority = $priority;
$this->resposible = $resposible;
$this->billed = $billed;
$this->paid = $paid;
$this->customer_id = $customer_id;
$this->description = $description;
}
public function find_open_orders_by_amount($db, $amount) {
echo 'asd';
$i = 0;
$orders = array();
$conn = $db->getReadConnection();
if ($conn) {
$query = mysqli_query($conn, 'SELECT * FROM `order` WHERE finished IS NULL AND NOT status = 4 ORDER BY id LIMIT '. $amount);
if (mysqli_num_rows($query) == 0) {
echo mysqli_error($conn);
} else {
while ($row = mysqli_fetch_assoc($query)) {
$orders[$i++] = new order($row['id'], $row['created'],
$row['changed'], $row['finished'],
$row['status'], $row['priority'], $row['responsible'],
$row['billed'], $row['paid'], $row['customer_id'], $row['description']);
}
}
}
$db->closeDb($conn);
return $orders;
}
}
?>