Jump to content
php.lv forumi

no $_GET uz masiiviem


Klokjis

Recommended Posts

varianc taads, ka ir

 

switch($_GET['picture']) {
	case '1':
$pic = 'bilde1.jpg';
	break;
....

 

kjipa ieraxtiic katrs nosaukums... a kaa buutu vienkaarshaak uztaisiit taa ka pac skripc nolasa foldera saturu un ieraxta masiivos. taa kaa nav sanaacis njemties ar masiiviem, tad jaaluudz kaada paliidziiba. :(

 

uzraku kaut kaadu skriptinju paluureet:

 

$path = "images";

$files = "0";
$handle=opendir($path);
while ($file = readdir($handle)) {
if(!is_dir($path."/".$file) && $file != "." && $file!="..") {
$extension = explode (".", $file);
$extension_i = (count($extension) - 1); 
$ext = $extension[$extension_i];
if($ext=="jpg"||$ext=="jpeg"||$ext=="JPG"||$ext=="JPEG") {
$images[$files] = $file;
$files++;
}
}
}

... taalaak aiziet tur jau bilzhu skatiishanaas

 

ceru ka saprataat manu ideju :\\

Link to comment
Share on other sites

es nesapratu ko tieshi vajag...

vai tikai sho - $bildes_masivs[] = $kaarteejaa_bilde; ? vai attieciigo bildi izvadiit bez switch garaas rakstiishanas(shajaa gadiijumaa nav jeegas no bilzhu masiivaa likshanas, bet vienkaarshi $bilde = "bilde".$_GET['picture'].".jpg" ) vai ko?

Link to comment
Share on other sites

×
×
  • Create New...