Can I use php to check whether a php file's syntax is iegal or not

13 kali dilihat
Langsung ke pesan pertama yang belum dibaca

Reeze

belum dibaca,
6 Okt 2009, 03.02.3506/10/09
kepadaProfessional PHP Developers
Hi, All!

I wrote a simple template engine, it compile my template to php
file like Smarty does, but sometimes, the compiled php file syntax is
illegal, so how can I catch this "exception" in PHP.

Thanks

Best Regards
reeze.

crim...@googlemail.com

belum dibaca,
6 Okt 2009, 19.37.3006/10/09
kepadaProfessional PHP Developers


On 6 окт, 10:02, Reeze <reeze....@gmail.com> wrote:
> Hi, All!
>
>    I wrote a simple template engine, it compile my template to php
> file like Smarty does, but sometimes, the compiled php file syntax is
> illegal, so  how can I catch this "exception" in PHP.

http://www.php.net/manual/en/function.php-check-syntax.php

Gary Every

belum dibaca,
6 Okt 2009, 21.24.0106/10/09
kepadaprofessi...@googlegroups.com
$filename = '/tmp/phpfile.php';
$output = exec('/usr/bin/php -l $filename');
if($output != 'syntax OK') {
 // you have an error, deal accordingly
}



--
Gary Every
"Pay it Forward!"

Balas ke semua
Balas ke penulis
Teruskan
0 pesan baru