第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

嘗試獲取字段值時出現(xiàn)“數(shù)組到字符串轉換錯誤”

嘗試獲取字段值時出現(xiàn)“數(shù)組到字符串轉換錯誤”

不負相思意 2021-08-20 19:31:10
我正在嘗試將數(shù)據(jù)表作為服務器端處理。它以某種方式起作用。我想將字段傳遞給 ajax 文件并使用它們來獲取數(shù)據(jù)。我將字段名稱設為字符串以使用分隔符分隔它們。然后我傳遞了字符串并獲取它并將它們作為一個數(shù)組。問題是,當我嘗試通過它們獲取值時會顯示“數(shù)組到字符串轉換錯誤”。十月 CMS 中的 PHP 塊<?phpfunction onStart(){    $this['tableName'] = 'BYAPPS_apps_data';    $this['fields'] = "app_id|app_name|app_ver|byapps_ver";}?>10 月 CMS 中的 Javascript(與 php 塊相同的頁面)  var table = $('#' + tableId).DataTable( {      processing: true,      serverSide: true,      ajax: {          url: '/ajax?tb={{ tableName|raw() }}&fd={{ fields|raw() }}',          type: 'GET',          error: function(e) {            console.log(e);          }      },      paging: true,      pageLength: 50,Ajax 頁面function onStart(){   $table = $_GET['tb'];   $length = $_GET['length'];   $start = $_GET['start'];   $fields = explode("|", $_GET['fd']);   $result = DB::table($table)->skip($start)->limit($length)->get();   $data = array();   foreach($result as $row) {      $sub_array = array();      for ($i = 0; $i < count($fields); $i++) {        echo "<script>console.log('".$fields[$i]."')</script>";        $sub_array[] = $row->$fields[$i];      }      $data[] = $sub_array;   }該$fields[$i]節(jié)目“APP_ID”,“APP_NAME” ...但我不知道為什么我不能通過這樣得到的數(shù)值。$row->$fields[$i] 我該如何解決這個問題?$result 包含這些類似下面的數(shù)據(jù)。object(October\Rain\Support\Collection)#947 (1) { ["items":protected]=> array(50) { [0]=> object(stdClass)#949 (88) { ["idx"]=> int(1) ["o_idx"]=> int(0) ["mem_id"]=> string(20) "epicegirls@naver.com" ["app_id"]=> string(10) "epicegirls" ["recom_id"]=> string(6) "byapps" ["app_cate"]=> string(2) "01" ["app_process"]=> int(8) ["app_name"]=> string(12) "????" ["service_type"]=> string(3) "biz" ["server_group"]=> string(1) "2" ["apps_type"]=> string(19) "?
查看完整描述

1 回答

?
犯罪嫌疑人X

TA貢獻2080條經驗 獲得超4個贊

試試這個

$sub_array[] = $row->{$fields[$i]};


查看完整回答
反對 回復 2021-08-20
  • 1 回答
  • 0 關注
  • 220 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號