123456789101112131415161718192021222324252627282930313233 |
- <?php
- namespace Spider\Lib\Doc;
- use Dever;
- class Json
- {
- public static function init($html)
- {
- if (is_string($html)) {
- return json_decode($html, true);
- }
- return $html;
- }
- public static function get($data)
- {
- return $data;
- }
- public static function find($data, $rule)
- {
- $rule = str_replace('$json', '$data', $rule);
- $cmd = '$data = ' . $rule . ';';
- eval($cmd);
- return $data;
- }
- public static function rule($doc, $data, $col, $rule, $key)
- {
- $result = Core::rule($doc, $data, $col, $rule, $key);
- return $result;
- }
- }
|