Ryan Bayne
asked on
Proper Way To Include PEAR CSV Extension
Hi
I've been using this function for a year now. It does work I know that but occasionally, someone has issues with it on their server.
I'm just wondering if anyone can spot an issue or can suggest a better approach. This approach is far older than a year so I thought it might be worth a try.
Thanks
I've been using this function for a year now. It does work I know that but occasionally, someone has issues with it on their server.
I'm just wondering if anyone can spot an issue or can suggest a better approach. This approach is far older than a year so I thought it might be worth a try.
Thanks
function wtgpt_pearcsv_include(){
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN'){
ini_set('include_path',rtrim(ini_get('include_path'),';').';'.dirname(__FILE__).'/pear/');
}else{
ini_set('include_path',rtrim(ini_get('include_path'),':').':'.dirname(__FILE__).'/pear/');
}
require_once 'File/CSV.php';
}
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
If you think it looks good then I'm sticking with it. I'm just checking because I was still really new to PHP when I started using this.
Thanks