嗨,我有一个这样的txt文件:
lenovo,pc,mouse
mac,pc,mouse
dell,pc,mouse
,我想创建一个txt文件字符串(pc名称)第一部分的下拉列表。这是我的代码,但是我不想要它。它不会爆炸。有什么帮助吗?
echo "Which pc are you using?? <br>";
$pc = file('pc.txt');
$name = ' ';
$name.="<option>Choose please</option>";
foreach ($pc as $type) {
$name .= '<option value="'.$type.'">'.$type.'</option>';
explode(',',$name);}
$select = '<select name="pc">'.$name.'</select>';
echo $select;
答案 0 :(得分:0)
您必须爆炸$ type
echo "Which pc are you using?? <br>";
$pc = file('pc.txt');
$name = ' ';
$name.="<option>Choose please</option>";
foreach ($pc as $type) {
$pc_name = explode(',',$type);
$name .= '<option value="'.$pc_name[0].'">'.$pc_name[0].'</option>';
// explode(',',$name);
}
$select = '<select name="pc">'.$name.'</select>';
echo $select;
答案 1 :(得分:0)
从创建选项的循环内部的文件中断开行。
asset ProductionRecord identified by productionId{
o String productionId
o ProductionDetails productionDetails
--> Order order
--> Manufacturer factory
}
asset Order identified by orderId {
o String orderId
o GarmentDetails garmentDetails
o OrderStatus orderStatus
--> Customer orderer
}