前段時間將客戶的phpcms站點升級到php7.2,相對比較順利,可是今天他反應文章沒法修改了,提示Uncaught Error: [] operator not supported for strings 錯誤,這就有點尷尬了,多是PHP7以上對語法要求比較嚴謹,那咱們就照着錯誤提示來尋找解決方案php
Fatal error: Uncaught Error: [] operator not supported for strings in *****\phpcms\modules\admin\classes\push_api.class.php:145 Stack trace: #0 *****\phpcms\modules\admin\classes\push_api.class.php(50): push_api->position_list(Array, Array, 0, 'content_model') #1 *****\caches\caches_model\caches_data\content_update.class.php(62): push_api->position_update(4, 1, 14, Array, Array, 0) #2 *****\caches\caches_model\caches_data\content_update.class.php(18): content_update->posid('posids', Array) #3 *****\phpcms\model\content_model.class.php(303): content_update->update(Array) #4 *****\phpcms\modules\content\content.php(221): content_model->edit_content(Array, 4) #5 *****\phpcms\libs\classes\application.class.php(31): content->edit() #6 *****\phpcms\libs in *****\phpcms\modules\admin\classes\push_api.class.php on line 145
打開/phpcms/modules/admin/classes/push_api.class.php,大概在約 141行,api
$fields_arr = $fields_value = '';
將它改成php7
$fields_arr = $fields_value = [];
保存,上傳,覆蓋文件,從新編輯一下文章看看,此次果真能夠了app