PHPを実行した際に以下のエラーが出ます。
[Thu Sep 26 13:59:49.670478 2019] [php7:emerg] [pid 6324] [client 192.168.10.90:10788] PHP Parse error: syntax error, unexpected '"', expecting '-' or identifier (T_STRING) or variable (T_VARIABLE) or number (T_NUM_STRING) in /var/www/html/shinobu/app/Models/T_access_log.php on line 31
[Thu Sep 26 13:59:49.670490 2019] [php7:error] [pid 6324] [client 192.168.10.90:10788] PHP Fatal error: Exception thrown without a stack frame in Unknown on line 0
これより前の行にエラーがあると思い、削除したりしてみたのですが解決しません。
以下が対象のコードになります。
PHPは7.2になります
<?php namespace App\Models; use Illuminate\Support\Facades\DB; use Illuminate\Database\Eloquent\Model; use Illuminate\Pagination\LengthAwarePaginator; class T_access_log extends Model { public static function getList(){ $sql = <<< SQL SELECT * FROM public.t_access_log SQL; $data = DB::select($sql); return $data; } public static function pushList($req,$log_kbn,$pid,$method,$query,$ip){ $q_tmp=str_replace(array('\', '%', '_'),array('\\', '\%', '\_'), $query); if(is_array($query)==TRUE){ $q_tmp = implode(",", $q_tmp); } $q = substr(pg_escape_string($q_tmp),0,2000); $day = date("YmdHis"); $prid = substr($pid,0,20); $host = gethostbyaddr($_SERVER["REMOTE_ADDR"]); $user = get_current_user(); if(substr($pid,0,6)!="assets"){ $sql = <<< SQL INSERT INTO t_access_log ( access_log_kbn, program_id, shori_date_time, ip_address, action_method, message, deleted_flg, create_terminal_name, create_windows_user_name, create_tantosha_id, create_tantosha_name, create_program_id, create_date_time ) VALUES ( '{$log_kbn}', '{$prid}', '{$day}', '{$ip}', '{$method}', '{$q}', '0', '{$host}', '{$user}', '{$req['tantosha_id']}', '{$req['tantosha_name']}', '{$req['program_id']}', current_timestamp ) SQL; DB::insert($sql); } return ; } public static function SYNV0010( $req ,$hanyo ,$ip=null ,$from=null ,$to=null ,$tfrom=null ,$tto=null ,$mfrom=null ,$mto=null ,$kbn=null ,$method=null ,$pid=null ) { $sql = <<<SQL SELECT ta.shori_date_time, ta.access_log_kbn, ta.program_id, mh.data_name, ta.action_method, ta.ip_address, ta.message, ta.create_terminal_name, ta.create_windows_user_name FROM public.t_access_log AS ta LEFT JOIN public.m_hanyo AS mh ON ta.program_id=mh.data_id AND mh.kojo_code='{$req->session()->get('KOJO_CODE')}' WHERE 1=1 SQL; if(!empty($ip)){ $sql.=" AND ip_address LIKE '"; foreach($ip as $ipa){ if(!empty($ipa)){ $sql.=$ipa.'.'; }else{ $sql.='%'.'.'; } } $sql=rtrim($sql, '.'); $sql.="'"; } if(!empty($from)){ $fr = preg_replace('/[^0-9]/', '', mb_convert_kana($from, 'kvrn')); if(!empty($tfrom)){ if(mb_strlen($tfrom)==1){ $tfrom='0'.$tfrom; } $fr.=mb_convert_kana($tfrom, 'kvrn'); if(!empty($mfrom)){ if(mb_strlen($mfrom)==1){ $mfrom='0'.$mfrom; } $fr.=mb_convert_kana($mfrom, 'kvrn'); } } $fr=str_pad($fr, 14, 0, STR_PAD_RIGHT); $sql.=<<<SQL AND shori_date_time>='{$fr}' SQL; } if(!empty($to)){ $t = preg_replace('/[^0-9]/', '', mb_convert_kana($to, 'kvrn')); if(!empty($tto)){ if(mb_strlen($tto)==1){ $tto='0'.$tto; } $t.=mb_convert_kana($tto, 'kvrn'); if(!empty($mto)){ if(mb_strlen($mto)==1){ $mto='0'.$mto; } $t.=mb_convert_kana($mto, 'kvrn'); }else{ $t.='5959'; } }else{ $t.='235959'; } $t=str_pad($t, 14, 0, STR_PAD_RIGHT); $sql.=<<<SQL AND shori_date_time<='{$t}' SQL; } if(!empty($kbn)){ switch ($kbn) { case '1': $kubun="001"; break; case '2': $kubun="002"; break; case '3': $kubun="003"; break; default: $kubun=""; break; } $sql.=<<<SQL AND access_log_kbn='{$kubun}' SQL; } if(!empty($method)){ $sql.=<<<SQL AND action_method='{$method}' SQL; } if(!empty($pid)){ $sql.=<<<SQL AND program_id LIKE '%{$pid}%' SQL; } $sql .= <<<SQL ORDER BY shori_date_time DESC SQL; $alldata = DB::select($sql); if(isset($req->page)==false){ $page=1; }else{ $page=$req->page; } $disp_limit=$hanyo[0]->suchi2; $skip = $disp_limit * ($page-1); $disp_data = array_slice($alldata,$skip,$disp_limit); if(count($alldata)<$hanyo[0]->suchi1){ $amount =count($alldata); }else{ $amount = $hanyo[0]->suchi1; } $path = array('path'=>'/'.$req->path()); $data = new LengthAwarePaginator($disp_data , $amount, $disp_limit, $page, $path); return $data; } }
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。