Jump to content

adige

New Members
  • Posts

    9
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

adige's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. yes I have tried but I can't it in the Zip file
  2. <?php $zip = new ZipArchive; $res = $zip->open('test.zip'); if ($res === TRUE) { $zip->renameName('currentname.txt','newname.txt'); $zip->close(); } else { echo 'failed, code:' . $res; } ?> I can rename a text file name but I can't rename a folder name.Can you help me?
  3. Dear friends, I know Zip a file in PHP but I can't Zip a directory.How to Zip a directory in PHP?Can you give an example?
  4. yes I know that but I dont want it.I have a text file. example.txt bla bala bala bla bala kskskkskskskskks >>>I want to update only this row kskskskskksksksk
  5. I have example.txt file.I want to update it files fows by a form.But I cant update it
  6. Hi, I want to update a txt files 10. row with a form but I could not it how can I do it?
  7. Thank you for your answer but I don't see any error :S
  8. Hi everyone,I want to learn PHP hook and I try hook examples.I tired this example but I saw only white page.It has a problem but I can't understand it Codes; hook.php <?php class Hooks { public function add($hook,$class=null,$method=null,$args=null) { if (empty($method)) error("You must include a method (function) when defining add_hook."); $this->hooks[$hook][]=array((!empty($class)?array($class,$method):$method),$args); return $this; } public function clear($hook=null) { if (!empty($hook)) unset($this->hooks[$hook]); else $this->hooks=null; } public function run($hook) { if (empty($this->hooks[$hook])) return $this; foreach ($this->hooks[$hook] as $hkey=>$hvalue) { if (is_array($hvalue[0])) $hvalue[0]=array($hvalue[0][0],$hvalue[0][1]); if (!empty($hvalue[1])) if (!is_array($hvalue[1])) call_user_func($hvalue[0],$hvalue[1]); else call_user_func_array($hvalue[0],$hvalue[1]); else call_user_func($hvalue[0]); } return $this; } } ?> script.php <?php // For a function: function doTitle() { echo $current->title; } $hooks->add('head_title',null,'doTitle'); // For a class: class Output { function body_final() { echo implode("\n",$this->body); } } $hooks->add('page_body','Output','body_final'); // To pass multiple arguments into a function, you must use: function test($arg1,$arg2) { echo "Arg1: {$arg1}, Arg2: {$arg2}"; } $hooks->add('page_body',null,'test',array('test','ing')); ?> index.php <?php // You must include the hook file here, or you can make an includes file to do all of your startup (as is normally done). include 'hook.php'; include 'script.php'; ?><!DOCTYPE html> <html> <head> <?php run('head_meta'); ?> <title><?php $hooks->run('head_title'); ?></title> <?php $hooks->run('head_links'); $hooks->run('head_scripts'); ?> </head> <body> <?php $hooks->run('page_body'); ?> </body> </html> Thank you
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.