我无法让它发挥作用,但我仍在努力
PHP警告:非法字符串偏移'脚本' PHP警告:非法字符串偏移'show_type' PHP警告:非法字符串偏移'content_line1'
/**
* makeFromRow
******************************************************/
function makeFromRow($row="") {
$status = new ItemStatus();
$this->discount_id = ($row["discount_id"]) ? $row["discount_id"] : "";
$this->entered = ($row["entered"]) ? $row["entered"] : ($this->entered ? $this->entered : "");
$this->updated = ($row["updated"]) ? $row["updated"] : ($this->updated ? $this->updated : "");
$this->id = ($row["id"]) ? $row["id"] : ($this->id ? $this->id : 0);
$this->account_id = ($row["account_id"]) ? $row["account_id"] : 0;
$this->image_id = ($row["image_id"]) ? $row["image_id"] : ($this->image_id ? $this->image_id : 0);
$this->image_id1 = ($row["image_id1"]) ? $row["image_id1"] : ($this->image_id1 ? $this->image_id1 : 0);
$this->image_id2 = ($row["image_id2"]) ? $row["image_id2"] : ($this->image_id2 ? $this->image_id2 : 0);
$this->image_id3 = ($row["image_id3"]) ? $row["image_id3"] : ($this->image_id3 ? $this->image_id3 : 0);
$this->image_id4 = ($row["image_id4"]) ? $row["image_id4"] : ($this->image_id4 ? $this->image_id4 : 0);
$this->category_id = ($row["category_id"]) ? $row["category_id"] : 0;
$this->renewal_date = ($row["renewal_date"]) ? $row["renewal_date"] : ($this->renewal_date ? $this->renewal_date : 0);
$this->destination_url = ($row["destination_url"]) ? $row["destination_url"] : "";
$this->display_url = ($row["display_url"]) ? $row["display_url"] : "";
$this->destination_protocol = ($row["destination_protocol"]) ? $row["destination_protocol"] : "";
$this->caption = ($row["caption"]) ? $row["caption"] : "";
$this->caption1 = ($row["caption1"]) ? $row["caption1"] : "";
$this->caption2 = ($row["caption2"]) ? $row["caption2"] : "";
$this->caption3 = ($row["caption3"]) ? $row["caption3"] : "";
$this->caption4 = ($row["caption4"]) ? $row["caption4"] : "";
$this->status = ($row["status"]) ? $row["status"] : ($this->status ? $this->status : $status->getDefaultStatus());
$this->type = ($row["type"]) ? $row["type"] : ($this->type ? $this->type : 0);
$this->section = ($row["section"]) ? $row["section"] : ($this->section ? $this->section : "general");
$this->target_window = ($row["target_window"]) ? $row["target_window"] : 2;
$this->content_line1 = ($row["content_line1"]) ? $row["content_line1"] : "";
$this->content_line11 = ($row["content_line11"]) ? $row["content_line11"] : "";
$this->content_line12 = ($row["content_line12"]) ? $row["content_line12"] : "";
$this->content_line13 = ($row["content_line13"]) ? $row["content_line13"] : "";
$this->content_line14 = ($row["content_line14"]) ? $row["content_line14"] : "";
$this->content_line2 = ($row["content_line2"]) ? $row["content_line2"] : "";
$this->content_line21 = ($row["content_line21"]) ? $row["content_line21"] : "";
$this->content_line22 = ($row["content_line22"]) ? $row["content_line22"] : "";
$this->content_line23 = ($row["content_line23"]) ? $row["content_line23"] : "";
$this->content_line24 = ($row["content_line24"]) ? $row["content_line24"] : "";
$this->unpaid_impressions = ($row["unpaid_impressions"]) ? $row["unpaid_impressions"] : ($this->unpaid_impressions ? $this->unpaid_impressions : 0);
$this->impressions = ($row["impressions"]) ? $row["impressions"] : ($this->impressions ? $this->impressions : 0);
$this->unlimited_impressions = ($row["unlimited_impressions"]) ? $row["unlimited_impressions"] : ($this->unlimited_impressions ? $this->unlimited_impressions : "n");
$this->expiration_setting = ($row["expiration_setting"]) ? $row["expiration_setting"] : 0;
$this->show_type = ($row["show_type"]) ? $row["show_type"] : 0;
$this->script = ($row["script"]) ? $row["script"] : "";
}
/**
* Save
******************************************************/
答案 0 :(得分:0)
您可以始终添加isset
功能:
例如,替换所有$row[
:
...
$this->show_type = ($row["show_type"]) ? $row["show_type"]: 0;
...
为:
...
$this->show_type = (isset($row["show_type"])) ? $row["show_type"]: 0;
...