Jump to content
php.lv forumi

class, atributi un ieksejas funkcijas..


blondine

Recommended Posts

tatad ir:

class History {
             private $mainigie...
     function history(){
             if (isset($_GET... utt
     }

     public function getHistory()
     {
             foreach (glob($this->dir."*.txt") as $path) {
             ...
             }
     }
...
}

 

un pietrukst kompitence kaa nodefineet UNLINK funkciju, kuru varetu izsaukt foreach ciklaa.. kur tiek padots ID.. varbut kadam ir idejas?!

Edited by blondine
Link to comment
Share on other sites

Pasaki ko tu īsti gribi panākt. Izmest mainīgo no atmiņas? Parādi kādu piemēru. unset darbojas visur.

 

Unset jā, a viņam vajag unlink :p (vienreiz kādas 20 min nočakarējos, kamēr sapratu, ka ar unset failu neizdzēsīšu :D)

Link to comment
Share on other sites

	public function isDeleteHistory() {
	if(is_file("$file")) {
unlink("$file");
}

 

kko tadu uzmetu, bet nestrada..

 

foreach (glob($this->dir."*.txt") as $path) {
		$history = fopen($path, "rb+");	

			$delPostURL = "<a href='?menu=history".$this->isDeleteHistory($path)."'>
				           <img class='play' src='./images/del.png'style='width:15px;float:right;'/>
				      </a>";
{

Link to comment
Share on other sites

Tas kods nu ir ūber.

 

Sākumā padod metodei $path, bet pašā metodē nemaz neskaties uz viņu un nenorādi ka tāds būtu jāpadod...linkā tiek likts es pat nezinu kas, jo tas isDeleteHistory neko neatgriež, tikai izdzēš kaut kādu failu (kas reāli, protams, nenotiek, jo nepastāv tāds $file mainīgais nemaz). Reāli tam linkam nav jēgas jo viss jau ir izdzēsts tā ģenerācijas laikā...

 

Vārdu sakot tas kods ir FAIL.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...