Ali*_*der 1 php scripting if-statement
嘿,我的网上有9种类型.我必须为每种类型设置不同的关键字.用这个脚本;
if ($type = movie) {
$yazdir = "DVDRip, DVDScr";
}
elseif ($type = game) {
$yazdir = "Full Version, Patch";
}
Run Code Online (Sandbox Code Playgroud)
我可以写两种类型的关键字.如何正确地重复其他类型?(echo paramether必须是$ yazdir)
三种选择:
switchhttp://php.net/manual/en/control-structures.switch.php
3.使用关联数组
$types = array(
"movies" => "DVDRip, DVDScr",
"games" => "Full Version, Patch",
...
);
Run Code Online (Sandbox Code Playgroud)