$conf, $runtime; function_exists('chdir') AND chdir(APP_PATH); $r = 'mysql' == $conf['cache']['type'] ? website_set('runtime', $runtime) : cache_set('runtime', $runtime); } function runtime_truncate() { global $conf; 'mysql' == $conf['cache']['type'] ? website_set('runtime', '') : cache_delete('runtime'); } register_shutdown_function('runtime_save'); ?>codeigniter 4 - ParseError syntax error, unexpected '|', expecting ';' or '{' FC|Programmer puzzle solving
最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

codeigniter 4 - ParseError syntax error, unexpected '|', expecting ';' or '{' FC

matteradmin6PV0评论

I use codeigniter 4 and PhpSpreadsheet to export data to excel..when I try it on localhost there are no problems..but when I try it on hosting, when I export I get an error

ParseError syntax error, unexpected '|', expecting ';' or '{' FCPATH/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Spreadsheet.php at line 269

my model

public function datapmk($tr = null, $thn = null)
{
    $this->db = \Config\Database::connect();
    $triwulan = "'%" . $tr . "%'";
    $tahun = "'%" . $thn . "%'";
    $this->select("lingkungan_nama,
    COUNT( DISTINCT(urut_rumah)) rmh,
    SUM(CASE WHEN pmk_id = 1 AND  jk = 1 AND triwulan_id LIKE   $triwulan    AND tahun LIKE $tahun THEN 1 ELSE 0 END) AS L_tidak,
    SUM(CASE WHEN pmk_id = 1 AND  jk = 2 AND triwulan_id LIKE $triwulan AND tahun LIKE $tahun THEN 1 ELSE 0 END) AS P_tidak,
    SUM(CASE WHEN pmk_id = 1 AND triwulan_id LIKE $triwulan AND tahun LIKE $tahun THEN 1 ELSE 0 END) AS JLH_tidak");
    $this->groupBy('lingkungan_nama');
    $this->orderBy('lingkungan_nama', 'ASC');
    return $this->get()->getResultArray();
}

php installed on hosting v 8.1.31

I use codeigniter 4 and PhpSpreadsheet to export data to excel..when I try it on localhost there are no problems..but when I try it on hosting, when I export I get an error

ParseError syntax error, unexpected '|', expecting ';' or '{' FCPATH/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Spreadsheet.php at line 269

my model

public function datapmk($tr = null, $thn = null)
{
    $this->db = \Config\Database::connect();
    $triwulan = "'%" . $tr . "%'";
    $tahun = "'%" . $thn . "%'";
    $this->select("lingkungan_nama,
    COUNT( DISTINCT(urut_rumah)) rmh,
    SUM(CASE WHEN pmk_id = 1 AND  jk = 1 AND triwulan_id LIKE   $triwulan    AND tahun LIKE $tahun THEN 1 ELSE 0 END) AS L_tidak,
    SUM(CASE WHEN pmk_id = 1 AND  jk = 2 AND triwulan_id LIKE $triwulan AND tahun LIKE $tahun THEN 1 ELSE 0 END) AS P_tidak,
    SUM(CASE WHEN pmk_id = 1 AND triwulan_id LIKE $triwulan AND tahun LIKE $tahun THEN 1 ELSE 0 END) AS JLH_tidak");
    $this->groupBy('lingkungan_nama');
    $this->orderBy('lingkungan_nama', 'ASC');
    return $this->get()->getResultArray();
}

php installed on hosting v 8.1.31

Share Improve this question edited Mar 14 at 16:35 James Z 12.3k10 gold badges27 silver badges47 bronze badges asked Mar 14 at 5:47 Franky MoedakFranky Moedak 112 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

I suspect you will find that your Web hosting is running an older version of PHP. Equally you should look in /vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Spreadsheet.php at line 269 and see what is there.

Post a comment

comment list (0)

  1. No comments so far