есть такая вункция в классе engine
тупо забирает значение требуемого параметра из конфигурационного файла и в общем -то все правильно
conf:
vote_file = vote.file
возвращает vote.file
| Код | public function get_conf_param($param,$val = '\d',$sep = '=',$file = 'config.file') { if (!$this->file = fopen($file,'r')) { echo "Can't open!"; return FALSE; } else { do { // читаем стоки из конфига пока не найдем нужную директиву $this->str = fgets($this->file); } while (!preg_match('/^'.$param.' '.$sep.' ('.$val.')*/',$this->str)); fclose($this->file); // извлекаем параметр $this->val = explode($sep,$this->str); unset ($this->file,$this->str); return $this->val[1]; } }
|
есть другой класс в котором есть функция, в принципе из нее интересны только первые 4 строки
| Код | protected function make_sorce($name,$q,$it) { // создаим новый исходный файл 75: if (file_exists($name) or !$this->cfile = fopen($name,'w')) { echo "File exists or Can't open'"; return FALSE; } else { $r = fwrite($this->cfile,$q."\r\n"); for($i=0;$i<count($it);$i++) { fwrite($this->cfile,$it[$i]." = 0\r\n"); } unset ($this->cfile); return $r; } }
|
после вызова
| Код | $this->engn = new engine(); $this->make_sorce($this->engn->get_conf_param('vote_file','[0-9a-zA-Z_\.]'),$quest,$items);
|
ругается так
| Код | Warning: fopen( vote.file ) [function.fopen]: failed to open stream: Invalid argument in C:\www\module\vote.php on line 75 File exists or Can't open'
|
что не так я не пойму?
|