[8] ErrorException in RegionController.php line 67

未定义变量: val

  1. if(empty($data['adve']['nid1'])||empty($data['adve']['nid2'])){
  2. $this->error('此功能正在维护中');
  3. exit;
  4. }
  5. $result =Db::name('news')->field('id,title,img')->where('id='.$data['adve']['nid1'].' OR id='.$data['adve']['nid2'])->select()->toArray();
  6. // var_dump($result);exit();
  7. foreach ($result as $key => $value){
  8. if(!empty($value['text'])) $val = htmlspecialchars_decode($value['text']);
  9. if(empty($value['img'])){
  10. if(preg_match($preg,$val,$res)){
  11. $result[$key]['img'] = $res[2];
  12. }else{
  13. $result[$key]['img'] = $this->img_path($value['id']%10);
  14. }
  15. }else{
  16. $result[$key]['img'] = $value['img']; // __DIR__.'/'.$value['img'];
  17. }
  18. if(!empty($val)) $result[$key]['text'] = mb_substr(strip_tags($val),0,70,'utf-8').'...';
  19. $data['adve_news'][] = $result[$key];

Call Stack

  1. in RegionController.php line 67
  2. at Error::appError(8, 'Undefined variable: ...', '/www/wwwroot/hqzbw_n...', 67, ['preg' => '/<\s*img\s+[^>]*?src...', 'result' => [['id' => 1843, 'title' => '...', 'img' => ''], ['id' => 1885, 'title' => '...', 'img' => '']], 'value' => ['id' => 1843, 'title' => '...', 'img' => ''], ...]) in RegionController.php line 67
  3. at RegionController->index()
  4. at ReflectionMethod->invokeArgs(object(RegionController), []) in Container.php line 395
  5. at Container->invokeReflectMethod(object(RegionController), object(ReflectionMethod), ['r_uid' => '37', 'region' => '43']) in Module.php line 132
  6. at Module->think\route\dispatch\{closure}(object(Request), object(Closure), null)
  7. at call_user_func_array(object(Closure), [object(Request), object(Closure), null]) in Middleware.php line 185
  8. at Middleware->think\{closure}(object(Request))
  9. at call_user_func(object(Closure), object(Request)) in Middleware.php line 130
  10. at Middleware->dispatch(object(Request), 'controller') in Module.php line 137
  11. at Module->exec() in Dispatch.php line 168
  12. at Dispatch->run() in App.php line 469
  13. at App->think\{closure}(object(Request), object(Closure), null)
  14. at call_user_func_array(object(Closure), [object(Request), object(Closure), null]) in Middleware.php line 185
  15. at Middleware->think\{closure}(object(Request))
  16. at call_user_func(object(Closure), object(Request)) in Middleware.php line 130
  17. at Middleware->dispatch(object(Request)) in App.php line 472
  18. at App->run() in index.php line 37

Environment Variables

GET Dataempty
POST Dataempty
Filesempty
Cookiesempty
Sessionempty
Server/Request Data
USER www
HOME /home/www
SCRIPT_NAME /index.php
REQUEST_URI /news/region/index/r_uid/37/region/43.html
QUERY_STRING s=news/region/index/r_uid/37/region/43.html
REQUEST_METHOD GET
SERVER_PROTOCOL HTTP/1.1
GATEWAY_INTERFACE CGI/1.1
REDIRECT_QUERY_STRING s=news/region/index/r_uid/37/region/43.html
REDIRECT_URL /news/region/index/r_uid/37/region/43.html
REMOTE_PORT 39078
SCRIPT_FILENAME /www/wwwroot/hqzbw_net/public/index.php
SERVER_ADMIN webmaster@example.com
CONTEXT_DOCUMENT_ROOT /www/wwwroot/hqzbw_net/public
CONTEXT_PREFIX
REQUEST_SCHEME http
DOCUMENT_ROOT /www/wwwroot/hqzbw_net/public
REMOTE_ADDR 35.175.212.5
SERVER_PORT 80
SERVER_ADDR 172.18.247.160
SERVER_NAME www.hqzbw.net
SERVER_SOFTWARE Apache
SERVER_SIGNATURE <address>Apache Server at www.hqzbw.net Port 80</address>
LD_LIBRARY_PATH /www/server/apache/lib
PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin
HTTP_HOST www.hqzbw.net
HTTP_USER_AGENT claudebot
HTTP_ACCEPT */*
proxy-nokeepalive 1
REDIRECT_STATUS 200
FCGI_ROLE RESPONDER
PHP_SELF /index.php
REQUEST_TIME_FLOAT 1711634709.0823
REQUEST_TIME 1711634709
Environment Variablesempty
ThinkPHP Constants
APP_DEBUG true
CMF_ROOT /www/wwwroot/hqzbw_net/
APP_PATH /www/wwwroot/hqzbw_net/app/
WEB_ROOT /www/wwwroot/hqzbw_net/public/
HTMLPURIFIER_PREFIX /www/wwwroot/hqzbw_net/vendor/ezyang/htmlpurifier/library