Opencart从文件中读取数据

I am very new to open-cart.I have a task to read data from the file.

So i have made a function open-cart to read the file in model category.php

Code :

public function getFileData($category_id) {
    $file = fopen("temp.txt","r");
    $a = array();
    while(! feof($file))
    {
        array_push($a, fgetcsv($file));
    }
    fclose($file);
    return $a;
}

now when i call it from controller it gives me timeout error more than 60s. i increased the time out using set_time_limit but no effect.

But then i made a simple script to read file and it is reading it with in a milliseconds. But same code is not working in opencart.

I tried Google but found nothing . i am sure that i am missing something.Any help will be appreciated

Steps to try:

  1. Check the file permission (test by giving 777 permission).
  2. Verify the file path.
  3. Give absolute path to the file by using the constants in config.php file. For example if the file is in image/data folder give the file path as "DIR_IMAGE."/data/temp.txt".
  4. Confirm that the file exists by using php file_exists function: http://in2.php.net/file_exists.

Have a nice day !!