public String testMysqlCall() throws Exception {
try {
return gopuJdbcTemplate.query("select id from gopu limit 5", new IdMapper());
} catch( Exception e) {
throw e;
}
}
private class IdMapper implements ResultSetExtractor<String> {
public String extractData(ResultSet resultSet) throws SQLException {
String toReturn=null;
while(resultSet.next()) {
toReturn = resultSet.getString("id");
}
return toReturn;
}
}
如果没有循环并且使用单个对象,此代码工作文件但是当我在循环中使用此代码时,foreach($messages as $singleMsg) {
if ($uploadedFile) {
$selectedMessageReply = MessageReply::where('msg_id', $singleMsg)->first();
$selectedMessageReply->is_attachment = 1;
$selectedMessageReply->save();
$extension = $uploadedFile->getClientOriginalExtension();
$uploadedFile->move($pathToFile.$singleMsg, $selectedMessageReply->id . '.' . $extension);
}
}
函数给出move
,那么问题是什么以及如何修复它? / p>