Re: Rutina paa buscar un arhcivo en el path y saber si esta disponible para poder ejecutarlo...

From: Date: Fri, 30 May 2008 13:43:41 +0000
Subject: Re: Rutina paa buscar un arhcivo en el path y saber si esta disponible para poder ejecutarlo...
References: 1  Groups: php.general.es 
Request: Send a blank email to general-es+get-62726@lists.php.net to get a copy of this message
On 5/30/08, josu udaondo <josu@aranetsl.com> wrote: > function mifile_exists($archivo) > > // Esta funcion pasa por todo el path del sistema buscando el archivo en > cuestion para saber si cuando abro un cmd se puede ejecutar > > // o no > > { > > $dirs = explode(';',$_SERVER['PATH']); > > $retorno = false; > > foreach($dirs as $midir) > > { > > if (substr($midir,strlen($midir)-1,1)=="\\") $separador = ''; else > $separador ='\\'; > > //echo $midir.$separador."wscript.exe<br>"; > > if(file_exists($midir.$separador.$archivo)) $retorno = > true; Acá te faltó un break; por un tema de buenas practicas > > } > > return $retorno; > > } > > > > Fdo Josu Udaondo Orúe > > <http://www.aranetsl.com/> Aranet S.L. > División de Informática > Polígono Lezama Leguizamón > C/Guipuzcoa 31 > Etxebarri 48450-Vizcaya > Teléfono: 944497340 - 678973277 saludos!! -- Julio Araya C. Linux User #386141 Estudiante de Ingeniería Civil Informática Ubuntu User #14778 Universidad Técnica Federico Santa María Valparaíso - Chile http://www.delpho.cl

« previous php.general.es (#62726) next »