You are not logged in.
Dear visitor, welcome to Aqua Computer Forum. If this is your first visit here, please read the Help. It explains how this page works. You must be registered before you can use all the page's features. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.
Quoted
<html>
<head>
<title></title>
<meta name="author" content="DerMaddin">
<meta name="generator" content="Ulli Meybohms HTML EDITOR">
</head>
<?php
function download($file , $name) {
$size = filesize($file);
header("Content-type: application/octet-stream");
header("Content-disposition: attachment; filename=".$name);
header("Content-Length: ".$size);
header("Pragma: no-cache");
header("Expires: 0");
readfile($file);
}
function error(){
echo("Download fehlerhaft");
}
switch($id){
case "1": $file = "img/00001.jpg"; $name = "affe.jpg"; break;
default: error(); break;
}
// Download der Datei
download("$file","$name");
?>
<body text="#000000" bgcolor="#FFFFFF" link="#FF0000" alink="#FF0000" vlink="#FF0000">
<center>Der Download startet!</center>
</body>
</html>
}
Quoted from "hurra"
Außerdem gehören die Anführungszeichen hier:
download("$file","$name");
weg.
![]() |
Source code |
1 2 3 4 5 6 7 8 |
# schlecht: $str1 = "Dein Name lautet $name."; # besser: $str2 = 'Dein Name lautet ' . $name . '.'; # auch ne möglichkeit, z.b. bei ankertags: $str = sprintf('Dein Name lautet %s.', $name); |
![]() |
Source code |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
#php $str1 = sprintf('Dein Name ist %s.', $name); $str2 = sprintf('<a href="%s" title="%s">%s</a>', $url, $title, $label); # wiederverwendung von variablen, vgl. [url]http://de3.php.net/sprintf[/url] $str3 = sprintf('<a href="%1$s" title="%2$s">%$2s</a>', $url, $title); # python str1 = 'Dein Name ist %s.' % name str2 = '<a href="%s" title="%s">%s</a>' % (url, title, label) # benannte platzhalter; dictionary in der gleichen zeile... str3 = '<a href="%(url)s" title="%(title)s">%(label)s</a>' % ({'url': '...', 'title': '...', 'label': '...'}) # ... oder separat, z.b. weil aus nem datenbank-query bezogen dict = {'url': '...', 'title': '...', 'label': '...' str3b = '<a href="%(url)s" title="%(title)s">%(label)s</a>' % dict |
-