我有一个spec文件.我需要定义一个spec变量,它从系统上的一行文件中获取其值.
例如
%define path `cat /home/user/path_file`
Run Code Online (Sandbox Code Playgroud)
并且在path_file中是一行
/var/www/html/hosts
Run Code Online (Sandbox Code Playgroud)
这部分有效.我说从RPM BUILD输出开始有时值${path}实际上是我的命令cat /home/user/path_file,有时值是path_file(/ var/www/html/hosts)中的行应该是什么?
我有一个对象集合 - 其中一些包含空数组。
object(Illuminate\Support\Collection)#34225 (1) {
["items":protected]=>
array(0) {
}
}
object(Illuminate\Support\Collection)#34226 (1) {
["items":protected]=>
array(0) {
}
}
object(Illuminate\Support\Collection)#34227 (1) {
["items":protected]=>
array(0) {
}
}
object(Illuminate\Support\Collection)#34228 (1) {
["items":protected]=>
array(0) {
}
}
object(Illuminate\Database\Eloquent\Collection)#23760 (1) {
["items":protected]=>
array(2) {
[0]=>
object(App\Models\File)#23766 (27) {
["primaryKey":protected]=>
string(6) "FileID"
["table":protected]=>
Run Code Online (Sandbox Code Playgroud)
我可以使用某人的帮助来过滤对象集合,以便包含空数组的对象消失/删除。
这样剩下的就是具有非空数组的对象
object(Illuminate\Database\Eloquent\Collection)#23760 (1) {
["items":protected]=>
array(2) {
[0]=>
object(App\Models\File)#23766 (27) {
["primaryKey":protected]=>
string(6) "FileID"
Run Code Online (Sandbox Code Playgroud)
我已经使用填充集合
$things = $foos->get($thing->ID, collect());
Run Code Online (Sandbox Code Playgroud)
任何帮助将不胜感激