php - open csv in wordpress -
i have csv file contains user specific data load template on fly when user access's user area front end.
the csv self gets managed outside of wordpress , gets uploaded via ftp specific directory in wordpress framework.
as csv contains data required, didn't want create additional processes csv uploading database necessary.
i call function within template read csv file , convert array can manipulate data wish.
i have attempted following inserting following code template:
$file = fopen(get_option('siteurl') . '/wp-content/csv/userdata.csv',"r"); while(! feof($file)){ print_r(fgetcsv($file)); } fclose($file);
however doesn't seem work , after searching online cant seem figure out why. wordpress support trying do? if not, can achieve functionality. hope don't have outside of wordpress framework , include template via iframe.
as using get_option('siteurl') http://yoursiteurl
system send http request open file work need php curl extension installed in system. suggested access file directly using thing
$file = fopen(wp_content_dir . '/csv/userdata.csv',"r"); while(! feof($file)){ print_r(fgetcsv($file)); } fclose($file);
Comments
Post a Comment