find.'), array('$dom->find', ')->', '$dom->'), $rule); $cmd = '$dom = ' . $rule . ';'; eval($cmd); return self::findAttr($dom, $attr); } public static function each($rule) { $attr = ''; if (strpos($rule, '.each().') !== false) { $temp = explode('.each()', $rule); $rule = $temp[0]; $attr = '$' . $temp[1]; } return array($rule, $attr); } public static function findAttr($dom, $attr) { if (!$attr) { return $dom; } $data = array(); foreach ($dom as $k => $v) { $data[] = self::find(pq($v), $attr); } return json_encode($data, JSON_UNESCAPED_UNICODE); } public static function get($data) { return pq($data); } public static function rule($doc, $dom, $col, $rule, $key) { $result = Core::rule($doc, $dom, $col, $rule, $key); return $result; } }