note 14814 added to control-structures.switch.php

From: Date: Wed, 15 Aug 2001 21:39:46 +0000
Subject: note 14814 added to control-structures.switch.php
Groups: php.notes 
Request: Send a blank email to php-notes+get-16775@lists.php.net to get a copy of this message
In response to White's download script: This becomes very inefficient when dealing with hundreds or even thousands of files. If you must use this sort of scenario, simply use: <?php if ($file) { $download = $file.".zip"; include("$download"); } else { include("downloads.php"); } ?> where the header is file.php?file=file1 additionally, you may want to add a directory onto $download, etc. I don't know why someone would put file downloads in the same directory as the pages. http://www.php.net/manual/en/control-structures.switch.php

« previous php.notes (#16775) next »