NBS Posted September 20, 2007 Report Share Posted September 20, 2007 Varu derēt šis ir ļoti viegls, bet nevarēju atrast iekšs php.net Man vajadzētu tipa: Piem., man ir folderis NBS un tajā atradas .php fails, kurā es gribu izechot foldera nosaukumu kurā atrodas šis .php files, ka es to varetu izdarīt ? Lūdzu, palīdziet. Link to comment Share on other sites More sharing options...
Val Posted September 20, 2007 Report Share Posted September 20, 2007 (edited) php.net readdir //edit: neizlasīju līdz galam Edited September 20, 2007 by Val Link to comment Share on other sites More sharing options...
Roze Posted September 20, 2007 Report Share Posted September 20, 2007 getcwd(); http://lv.php.net/manual/en/function.getcwd.php Turpat koimentāros ir arī alternatīva str_replace($_SERVER['SCRIPT_NAME'],'', $_SERVER['SCRIPT_FILENAME']); p.s. Val readdir() dara pavisam ko citu.. Link to comment Share on other sites More sharing options...
NBS Posted September 20, 2007 Author Report Share Posted September 20, 2007 Liels paldies tagad zināšu sādu funkciju :) Link to comment Share on other sites More sharing options...
NBS Posted September 20, 2007 Author Report Share Posted September 20, 2007 Baigā nelaime ir tāda, ka man vajag tikai dir nosaukumu neviss pilnīgu norādi: C:\lalal\lalal Man vajag tikai: lalal, lai es varētu printēt to. Link to comment Share on other sites More sharing options...
Kavacky Posted September 20, 2007 Report Share Posted September 20, 2007 Nu tad izgriez pēdējo foldera nosaukumu ar explode. Link to comment Share on other sites More sharing options...
Val Posted September 20, 2007 Report Share Posted September 20, 2007 sadali stringu daļās pa \ tev vajag pēdējo masīva elem. Link to comment Share on other sites More sharing options...
NBS Posted September 20, 2007 Author Report Share Posted September 20, 2007 Es jau atradu super funkciju: <?php function current_dir() { $path = dirname($_SERVER[PHP_SELF]); $position = strrpos($path,'/') + 1; print substr($path,$position); } current_dir(); ?> Paldies. Link to comment Share on other sites More sharing options...
Recommended Posts