你好这里是我在codeigniter控制器中编写的代码,当我运行此代码时出现Parse错误:语法错误,意外的'foreach'(T_FOREACH),请帮助我这个
let lineContent = "\"key\" = \" Χρήση παλιάς συνόμευση\";"
if let r = try? NSRegularExpression(pattern: "\"(.*)+\"(^|[ ]*)=(^|[ ]*)\"(.*)+\";", options: NSRegularExpressionOptions()) {
let match = r.matchesInString(lineContent, options: NSMatchingOptions(), range: NSMakeRange(0, lineContent.characters.count))
match.count
}
答案 0 :(得分:0)
需要关闭声明:
变化:
<td>"foreach($data['order_ids'] as $o_id)
要:
<td>";foreach($data['order_ids'] as $o_id)
答案 1 :(得分:0)
这个怎么样
<td>"; # close ;
foreach($data['order_ids'] as $o_id)
{
$o_id->order_id ; # use echo or some of your argument as well
}
"</td> # start "
答案 2 :(得分:0)
您不能在变量内部使用每个变量。请改为使用:
$template=" Hi Service Providers, Please find payment details for the week to
<table>
<tr>
<th>Category</th>
<th>order ids</th>
<th>Total Amount</th>
<th>Commission charged</th>
<th>online payment</th>
<th>Bro4u offers</th>
<th>Total payable</th>
</tr>
<tr>
<td>a</td>";
foreach($d as $o) {
$template.= "<td>".$o."</td>";
}
$template.="<td>adsfsaf</td>
<td>asdfdsf</td>
<td>online</td>
<td>offers</td>
<td>payable</td>
</tr>
</table>
<br/>Happy to serve,
<br/>Team Bro4u
<br/>";
答案 3 :(得分:0)
你不能在变量中使用foreach循环。您可以使用此类型 -
foreach($data['order_ids'] as $o_id)
{
$template.= "<td>".$o_id->order_id."</td>";
}