怎么访问模型对象里面的属性

浏览:5424 发布日期:2013/12/04 分类:求助交流 关键字: 模型 属性访问
$model = D('wallpapers');
dump($model);
object(Model)#9 (20) {
  ["_extModel":"Model":private] => NULL
  ["db":protected] => object(DbMysqli)#5 (18) {
    ["dbType":protected] => string(6) "MYSQLI"
    ["autoFree":protected] => bool(false)
    ["model":protected] => string(7) "_think_"
    ["pconnect":protected] => bool(false)
    ["queryStr":protected] => string(30) "SHOW COLUMNS FROM `wallpapers`"
    ["modelSql":protected] => array(2) {
      ["admin"] => string(130) "SELECT COUNT(id) AS tp_count FROM `admin` WHERE ( `name` = 'shine' ) AND ( `pass` = '202cb962ac59075b964b07152d234b70' ) LIMIT 1  "
      ["wallpapers"] => string(30) "SHOW COLUMNS FROM `wallpapers`"
    }
    ["lastInsID":protected] => NULL
    ["numRows":protected] => int(12)
    ["numCols":protected] => int(6)
    ["transTimes":protected] => int(0)
    ["error":protected] => string(0) ""
    ["linkID":protected] => array(1) {
      [0] => object(mysqli)#4 (18) {
        ["affected_rows"] => int(12)
        ["client_info"] => string(6) "5.5.20"
        ["client_version"] => int(50520)
        ["connect_errno"] => int(0)
        ["connect_error"] => NULL
        ["errno"] => int(0)
        ["error"] => string(0) ""
        ["field_count"] => int(6)
        ["host_info"] => string(25) "Localhost via UNIX socket"
        ["info"] => NULL
        ["insert_id"] => int(0)
        ["server_info"] => string(10) "5.5.23-cll"
        ["server_version"] => int(50523)
        ["stat"] => string(150) "Uptime: 1319442  Threads: 2  Questions: 155064146  Slow queries: 411  Opens: 709669  Flush tables: 1  Open tables: 64  Queries per second avg: 117.522"
        ["sqlstate"] => string(5) "00000"
        ["protocol_version"] => int(10)
        ["thread_id"] => int(11976305)
        ["warning_count"] => int(0)
      }
    }
    ["_linkID":protected] => object(mysqli)#4 (18) {
      ["affected_rows"] => int(-1)
      ["client_info"] => string(6) "5.5.20"
      ["client_version"] => int(50520)
      ["connect_errno"] => int(0)
      ["connect_error"] => NULL
      ["errno"] => int(0)
      ["error"] => string(0) ""
      ["field_count"] => int(6)
      ["host_info"] => string(25) "Localhost via UNIX socket"
      ["info"] => NULL
      ["insert_id"] => int(0)
      ["server_info"] => string(10) "5.5.23-cll"
      ["server_version"] => int(50523)
      ["stat"] => string(150) "Uptime: 1319442  Threads: 2  Questions: 155064146  Slow queries: 411  Opens: 709669  Flush tables: 1  Open tables: 64  Queries per second avg: 117.522"
      ["sqlstate"] => string(5) "00000"
      ["protocol_version"] => int(10)
      ["thread_id"] => int(11976305)
      ["warning_count"] => int(0)
    }
    ["queryID":protected] => object(mysqli_result)#6 (5) {
      ["current_field"] => int(0)
      ["field_count"] => int(6)
      ["lengths"] => NULL
      ["num_rows"] => int(12)
      ["type"] => int(0)
    }
    ["connected":protected] => bool(true)
    ["comparison":protected] => array(10) {
      ["eq"] => string(1) "="
      ["neq"] => string(2) "<>"
      ["gt"] => string(1) ">"
      ["egt"] => string(2) ">="
      ["lt"] => string(1) "<"
      ["elt"] => string(2) "<="
      ["notlike"] => string(8) "NOT LIKE"
      ["like"] => string(4) "LIKE"
      ["in"] => string(2) "IN"
      ["notin"] => string(6) "NOT IN"
    }
    ["selectSql":protected] => string(96) "SELECT%DISTINCT% %FIELD% FROM %TABLE%%JOIN%%WHERE%%GROUP%%HAVING%%ORDER%%LIMIT% %UNION%%COMMENT%"
    ["bind":protected] => array(0) {
    }
  }
  ["pk":protected] => string(2) "id"
  ["tablePrefix":protected] => string(0) ""
  ["name":protected] => string(10) "wallpapers"
  ["dbName":protected] => string(0) ""
  ["connection":protected] => string(0) ""
  ["tableName":protected] => string(0) ""
  ["trueTableName":protected] => string(10) "wallpapers"
  ["error":protected] => string(0) ""
  ["fields":protected] => array(15) {
    [0] => string(2) "id"
    [1] => string(6) "device"
    [2] => string(4) "type"
    [3] => string(8) "thumburl"
    [4] => string(6) "picurl"
    [5] => string(7) "pic_url"
    [6] => string(7) "content"
    [7] => string(8) "dateline"
    [8] => string(8) "lastdigg"
    [9] => string(5) "diggs"
    [10] => string(7) "reviews"
    [11] => string(4) "flag"
    ["_autoinc"] => bool(true)
    ["_pk"] => string(2) "id"
    ["_type"] => array(12) {
      ["id"] => string(7) "int(11)"
      ["device"] => string(29) "enum('iPhone','iPad','ipad3')"
      ["type"] => string(11) "varchar(60)"
      ["thumburl"] => string(12) "varchar(255)"
      ["picurl"] => string(12) "varchar(255)"
      ["pic_url"] => string(12) "varchar(255)"
      ["content"] => string(4) "text"
      ["dateline"] => string(7) "int(11)"
      ["lastdigg"] => string(7) "int(11)"
      ["diggs"] => string(7) "int(11)"
      ["reviews"] => string(7) "int(11)"
      ["flag"] => string(22) "enum('pending','open')"
    }
  }
  ["data":protected] => array(0) {
  }
  ["options":protected] => array(0) {
  }
  ["_validate":protected] => array(0) {
  }
  ["_auto":protected] => array(0) {
  }
  ["_map":protected] => array(0) {
  }
  ["_scope":protected] => array(0) {
  }
  ["autoCheckFields":protected] => bool(true)
  ["patchValidate":protected] => bool(false)
  ["methods":protected] => array(13) {
    [0] => string(5) "table"
    [1] => string(5) "order"
    [2] => string(5) "alias"
    [3] => string(6) "having"
    [4] => string(5) "group"
    [5] => string(4) "lock"
    [6] => string(8) "distinct"
    [7] => string(4) "auto"
    [8] => string(6) "filter"
    [9] => string(8) "validate"
    [10] => string(6) "result"
    [11] => string(4) "bind"
    [12] => string(5) "token"
  }
}
dump($model->pk);
dump($model->fields);

都是 NULL
最佳答案
评论() 相关
后面还有条评论,点击查看>>