├── css ├── weui3.css └── webToast.css ├── code ├── sample │ └── StudySamples │ │ └── unmark │ │ └── tmp ├── vendor │ ├── symfony │ │ ├── var-dumper │ │ │ ├── .gitignore │ │ │ ├── Tests │ │ │ │ ├── Fixtures │ │ │ │ │ ├── NotLoadableClass.php │ │ │ │ │ ├── FooInterface.php │ │ │ │ │ ├── xml_reader.xml │ │ │ │ │ ├── GeneratorDemo.php │ │ │ │ │ ├── dumb-var.php │ │ │ │ │ └── Twig.php │ │ │ │ ├── Test │ │ │ │ │ └── VarDumperTestTraitTest.php │ │ │ │ ├── Caster │ │ │ │ │ ├── RedisCasterTest.php │ │ │ │ │ ├── PdoCasterTest.php │ │ │ │ │ ├── SplCasterTest.php │ │ │ │ │ ├── XmlReaderCasterTest.php │ │ │ │ │ ├── CasterTest.php │ │ │ │ │ └── ReflectionCasterTest.php │ │ │ │ └── Cloner │ │ │ │ │ └── DataTest.php │ │ │ ├── CHANGELOG.md │ │ │ ├── Dumper │ │ │ │ └── DataDumperInterface.php │ │ │ ├── README.md │ │ │ ├── Cloner │ │ │ │ ├── ClonerInterface.php │ │ │ │ ├── Cursor.php │ │ │ │ ├── Stub.php │ │ │ │ └── DumperInterface.php │ │ │ ├── Resources │ │ │ │ └── functions │ │ │ │ │ └── dump.php │ │ │ ├── Caster │ │ │ │ ├── EnumStub.php │ │ │ │ ├── ConstStub.php │ │ │ │ ├── CutArrayStub.php │ │ │ │ ├── FrameStub.php │ │ │ │ ├── TraceStub.php │ │ │ │ ├── MongoCaster.php │ │ │ │ ├── SymfonyCaster.php │ │ │ │ ├── DoctrineCaster.php │ │ │ │ ├── CutStub.php │ │ │ │ ├── ResourceCaster.php │ │ │ │ ├── StubCaster.php │ │ │ │ ├── ArgsStub.php │ │ │ │ ├── XmlResourceCaster.php │ │ │ │ ├── RedisCaster.php │ │ │ │ ├── ClassStub.php │ │ │ │ ├── XmlReaderCaster.php │ │ │ │ ├── LinkStub.php │ │ │ │ ├── PdoCaster.php │ │ │ │ ├── DateCaster.php │ │ │ │ └── PgSqlCaster.php │ │ │ ├── Exception │ │ │ │ └── ThrowingCasterException.php │ │ │ ├── LICENSE │ │ │ ├── phpunit.xml.dist │ │ │ ├── VarDumper.php │ │ │ ├── composer.json │ │ │ └── Test │ │ │ │ └── VarDumperTestTrait.php │ │ └── polyfill-mbstring │ │ │ ├── README.md │ │ │ ├── composer.json │ │ │ ├── LICENSE │ │ │ └── bootstrap.php │ ├── autoload.php │ └── composer │ │ ├── autoload_namespaces.php │ │ ├── autoload_files.php │ │ ├── autoload_psr4.php │ │ ├── LICENSE │ │ ├── autoload_real.php │ │ ├── autoload_classmap.php │ │ ├── installed.json │ │ └── autoload_static.php ├── src │ ├── Repositories │ │ ├── Pretreatment │ │ │ ├── PretreatmentQinGuoRepository.php │ │ │ └── PretreatmentZhengFangRepository.php │ │ ├── Cutting │ │ │ └── CuttingZhengFangMoveRepository.php │ │ └── Identify │ │ │ ├── IdentifyZhengFangColLevenshteinRepository.php │ │ │ └── IdentifyZhengFangColRepository.php │ ├── Abstracts │ │ ├── Restriction.php │ │ └── Load.php │ ├── Config │ │ ├── sample.php │ │ ├── app.php │ │ └── training.php │ ├── Trait │ │ ├── PretreatmentTrait.php │ │ ├── CommonTrait.php │ │ ├── GetImageInfoTrait.php │ │ ├── IdentifyTrait.php │ │ └── CuttingTrait.php │ ├── App │ │ ├── index.php │ │ ├── GetImageInfo │ │ │ └── GetImageInfo.php │ │ ├── Pretreatment │ │ │ └── PretreatmentZhengFang.php │ │ ├── Identify │ │ │ ├── IdentifyZhengFangCol.php │ │ │ └── IdentifyZhengFangColLevenshtein.php │ │ ├── Cutting │ │ │ └── CuttingZhengFangFixed.php │ │ ├── IndexController.php │ │ ├── captcha.php │ │ └── ResultContainer.php │ └── Log │ │ └── Log.php ├── training │ ├── AddSamples │ │ └── Test.php │ ├── Abstracts │ │ └── TestsInterface.php │ ├── MultipleTests │ │ ├── Test.php │ │ └── NormalMultipleTests.php │ └── Trait │ │ └── CommonTrait.php ├── composer.json ├── semester.php ├── captcha.php ├── composer.lock └── function.php ├── image ├── 1.png ├── 2.png ├── 3.png ├── 4.png ├── 5.png ├── 6.png ├── 7.png ├── 8.png ├── 9.png ├── 10.png ├── 11.png ├── 12.png └── 13.png ├── README.md └── index.html /css/weui3.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /code/sample/StudySamples/unmark/tmp: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /image/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kbdxbt/cj/HEAD/image/1.png -------------------------------------------------------------------------------- /image/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kbdxbt/cj/HEAD/image/2.png -------------------------------------------------------------------------------- /image/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kbdxbt/cj/HEAD/image/3.png -------------------------------------------------------------------------------- /image/4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kbdxbt/cj/HEAD/image/4.png -------------------------------------------------------------------------------- /image/5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kbdxbt/cj/HEAD/image/5.png -------------------------------------------------------------------------------- /image/6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kbdxbt/cj/HEAD/image/6.png -------------------------------------------------------------------------------- /image/7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kbdxbt/cj/HEAD/image/7.png -------------------------------------------------------------------------------- /image/8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kbdxbt/cj/HEAD/image/8.png -------------------------------------------------------------------------------- /image/9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kbdxbt/cj/HEAD/image/9.png -------------------------------------------------------------------------------- /image/10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kbdxbt/cj/HEAD/image/10.png -------------------------------------------------------------------------------- /image/11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kbdxbt/cj/HEAD/image/11.png -------------------------------------------------------------------------------- /image/12.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kbdxbt/cj/HEAD/image/12.png -------------------------------------------------------------------------------- /image/13.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kbdxbt/cj/HEAD/image/13.png -------------------------------------------------------------------------------- /code/vendor/symfony/var-dumper/.gitignore: -------------------------------------------------------------------------------- 1 | composer.lock 2 | phpunit.xml 3 | vendor/ 4 | -------------------------------------------------------------------------------- /code/vendor/symfony/var-dumper/Tests/Fixtures/NotLoadableClass.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | With text 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /code/vendor/symfony/var-dumper/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | CHANGELOG 2 | ========= 3 | 4 | 3.4.0 5 | ----- 6 | 7 | * added `AbstractCloner::setMinDepth()` function to ensure minimum tree depth 8 | * deprecated `MongoCaster` 9 | 10 | 2.7.0 11 | ----- 12 | 13 | * deprecated Cloner\Data::getLimitedClone(). Use withMaxDepth, withMaxItemsPerDepth or withRefHandles instead. 14 | -------------------------------------------------------------------------------- /code/src/Abstracts/Restriction.php: -------------------------------------------------------------------------------- 1 | $vendorDir . '/symfony/polyfill-mbstring/bootstrap.php', 10 | '667aeda72477189d0494fecd327c3641' => $vendorDir . '/symfony/var-dumper/Resources/functions/dump.php', 11 | ); 12 | -------------------------------------------------------------------------------- /code/src/Abstracts/Load.php: -------------------------------------------------------------------------------- 1 | nextStep = $nextStep; 18 | } 19 | 20 | } -------------------------------------------------------------------------------- /code/vendor/composer/autoload_psr4.php: -------------------------------------------------------------------------------- 1 | array($vendorDir . '/symfony/polyfill-mbstring'), 10 | 'Symfony\\Component\\VarDumper\\' => array($vendorDir . '/symfony/var-dumper'), 11 | 'App\\' => array($baseDir . '/app'), 12 | ); 13 | -------------------------------------------------------------------------------- /code/training/AddSamples/Test.php: -------------------------------------------------------------------------------- 1 | run(); 17 | } 18 | } 19 | 20 | $t = new Test(); 21 | $t->t(); -------------------------------------------------------------------------------- /code/vendor/symfony/polyfill-mbstring/README.md: -------------------------------------------------------------------------------- 1 | Symfony Polyfill / Mbstring 2 | =========================== 3 | 4 | This component provides a partial, native PHP implementation for the 5 | [Mbstring](http://php.net/mbstring) extension. 6 | 7 | More information can be found in the 8 | [main Polyfill README](https://github.com/symfony/polyfill/blob/master/README.md). 9 | 10 | License 11 | ======= 12 | 13 | This library is released under the [MIT license](LICENSE). 14 | -------------------------------------------------------------------------------- /code/src/Config/sample.php: -------------------------------------------------------------------------------- 1 | __DIR__ . '/../../sample/TempSamples/' , 19 | 20 | 21 | ]; -------------------------------------------------------------------------------- /code/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "kurisu/captcha_reader", 3 | "description": "kurisu/captcha_reader", 4 | "type": "project", 5 | "license": "MIT", 6 | "authors": [ 7 | { 8 | "name": "kurisu", 9 | "email": "misaki.zhcy@gmail.com" 10 | } 11 | ], 12 | "minimum-stability": "stable", 13 | "require": { 14 | "symfony/var-dumper": "^3.4" 15 | }, 16 | "autoload": { 17 | "classmap": [ 18 | "src/", 19 | "training/" 20 | ], 21 | "psr-4": { 22 | "App\\": "app/" 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /code/training/Abstracts/TestsInterface.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\VarDumper\Dumper; 13 | 14 | use Symfony\Component\VarDumper\Cloner\Data; 15 | 16 | /** 17 | * DataDumperInterface for dumping Data objects. 18 | * 19 | * @author Nicolas Grekas 20 | */ 21 | interface DataDumperInterface 22 | { 23 | public function dump(Data $data); 24 | } 25 | -------------------------------------------------------------------------------- /code/vendor/symfony/var-dumper/README.md: -------------------------------------------------------------------------------- 1 | VarDumper Component 2 | =================== 3 | 4 | The VarDumper component provides mechanisms for walking through any arbitrary 5 | PHP variable. Built on top, it provides a better `dump()` function that you 6 | can use instead of `var_dump`. 7 | 8 | Resources 9 | --------- 10 | 11 | * [Documentation](https://symfony.com/doc/current/components/var_dumper/introduction.html) 12 | * [Contributing](https://symfony.com/doc/current/contributing/index.html) 13 | * [Report issues](https://github.com/symfony/symfony/issues) and 14 | [send Pull Requests](https://github.com/symfony/symfony/pulls) 15 | in the [main Symfony repository](https://github.com/symfony/symfony) 16 | -------------------------------------------------------------------------------- /code/training/MultipleTests/Test.php: -------------------------------------------------------------------------------- 1 | run('zhengfang', $i, 'sdfljsdkfjlksdjfklsdjkslfjklsdf'); 23 | } 24 | } 25 | 26 | $t = new Test(); 27 | $t->t(); -------------------------------------------------------------------------------- /code/vendor/symfony/var-dumper/Cloner/ClonerInterface.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\VarDumper\Cloner; 13 | 14 | /** 15 | * @author Nicolas Grekas 16 | */ 17 | interface ClonerInterface 18 | { 19 | /** 20 | * Clones a PHP variable. 21 | * 22 | * @param mixed $var Any PHP variable 23 | * 24 | * @return Data The cloned variable represented by a Data object 25 | */ 26 | public function cloneVar($var); 27 | } 28 | -------------------------------------------------------------------------------- /code/src/Trait/PretreatmentTrait.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | use Symfony\Component\VarDumper\VarDumper; 13 | 14 | if (!function_exists('dump')) { 15 | /** 16 | * @author Nicolas Grekas 17 | */ 18 | function dump($var) 19 | { 20 | foreach (func_get_args() as $var) { 21 | VarDumper::dump($var); 22 | } 23 | 24 | if (1 < func_num_args()) { 25 | return func_get_args(); 26 | } 27 | 28 | return $var; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /code/vendor/symfony/var-dumper/Caster/EnumStub.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\VarDumper\Caster; 13 | 14 | use Symfony\Component\VarDumper\Cloner\Stub; 15 | 16 | /** 17 | * Represents an enumeration of values. 18 | * 19 | * @author Nicolas Grekas 20 | */ 21 | class EnumStub extends Stub 22 | { 23 | public $dumpKeys = true; 24 | 25 | public function __construct(array $values, $dumpKeys = true) 26 | { 27 | $this->value = $values; 28 | $this->dumpKeys = $dumpKeys; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /code/vendor/symfony/var-dumper/Exception/ThrowingCasterException.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\VarDumper\Exception; 13 | 14 | /** 15 | * @author Nicolas Grekas 16 | */ 17 | class ThrowingCasterException extends \Exception 18 | { 19 | /** 20 | * @param \Exception $prev The exception thrown from the caster 21 | */ 22 | public function __construct(\Exception $prev) 23 | { 24 | parent::__construct('Unexpected '.get_class($prev).' thrown from a caster: '.$prev->getMessage(), 0, $prev); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /code/vendor/symfony/var-dumper/Caster/ConstStub.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\VarDumper\Caster; 13 | 14 | use Symfony\Component\VarDumper\Cloner\Stub; 15 | 16 | /** 17 | * Represents a PHP constant and its value. 18 | * 19 | * @author Nicolas Grekas 20 | */ 21 | class ConstStub extends Stub 22 | { 23 | public function __construct($name, $value) 24 | { 25 | $this->class = $name; 26 | $this->value = $value; 27 | } 28 | 29 | public function __toString() 30 | { 31 | return (string) $this->value; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /code/vendor/symfony/var-dumper/Caster/CutArrayStub.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\VarDumper\Caster; 13 | 14 | /** 15 | * Represents a cut array. 16 | * 17 | * @author Nicolas Grekas 18 | */ 19 | class CutArrayStub extends CutStub 20 | { 21 | public $preservedSubset; 22 | 23 | public function __construct(array $value, array $preservedKeys) 24 | { 25 | parent::__construct($value); 26 | 27 | $this->preservedSubset = array_intersect_key($value, array_flip($preservedKeys)); 28 | $this->cut -= count($this->preservedSubset); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /code/vendor/symfony/var-dumper/Caster/FrameStub.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\VarDumper\Caster; 13 | 14 | /** 15 | * Represents a single backtrace frame as returned by debug_backtrace() or Exception->getTrace(). 16 | * 17 | * @author Nicolas Grekas 18 | */ 19 | class FrameStub extends EnumStub 20 | { 21 | public $keepArgs; 22 | public $inTraceStub; 23 | 24 | public function __construct(array $frame, $keepArgs = true, $inTraceStub = false) 25 | { 26 | $this->value = $frame; 27 | $this->keepArgs = $keepArgs; 28 | $this->inTraceStub = $inTraceStub; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /code/src/App/index.php: -------------------------------------------------------------------------------- 1 | entrance($_POST['codeurl'],'online'); 16 | $a->image = str_replace('src\Config/../../','', $a->image); 17 | $a->image = substr($a->image,'24',strlen($a->image)-11); 18 | dump($c); 19 | echo ""; 20 | $end_time = microtime(true);//计时停止 21 | echo '执行时间为:' . ($end_time - $start_time) . ' s' . '
'; 22 | }else{ 23 | 24 | } 25 | 26 | 27 | ?> 28 |
29 | 30 |
31 | 请填写正方教务系统验证码的地址(类似“http://210.36.247.23/CheckCode.aspx”),提交即可查询验证码。目前系统只有正方教务系统的训练库, 整体识别正确率 87%,单个字母识别正确率率到 96.5%,每次提交只能测试一次。 32 |
-------------------------------------------------------------------------------- /code/semester.php: -------------------------------------------------------------------------------- 1 | = '10') { 10 | $str .= ''; 11 | } elseif ($month>'3' && $month<'10') { 12 | $str .= ''; 13 | } else { 14 | 15 | } 16 | for ($i=1; $i <= 3; $i++) { 17 | $str .= ' 18 | 19 | '; 20 | } 21 | !empty($_COOKIE['number']) ? ($number = $_COOKIE['number']) : ($number = ''); 22 | exit(json_encode(['data'=>$str,'number'=>$number])); 23 | 24 | 25 | -------------------------------------------------------------------------------- /code/src/Repositories/Cutting/CuttingZhengFangMoveRepository.php: -------------------------------------------------------------------------------- 1 | bar = 'bar'; 14 | 15 | $g = fopen(__FILE__, 'r'); 16 | 17 | $var = array( 18 | 'number' => 1, null, 19 | 'const' => 1.1, true, false, NAN, INF, -INF, PHP_INT_MAX, 20 | 'str' => "déjà\n", "\xE9\x00", 21 | '[]' => array(), 22 | 'res' => $g, 23 | 'obj' => $foo, 24 | 'closure' => function ($a, \PDO &$b = null) {}, 25 | 'line' => __LINE__ - 1, 26 | 'nobj' => array((object) array()), 27 | ); 28 | 29 | $r = array(); 30 | $r[] = &$r; 31 | 32 | $var['recurs'] = &$r; 33 | $var[] = &$var[0]; 34 | $var['sobj'] = $var['obj']; 35 | $var['snobj'] = &$var['nobj'][0]; 36 | $var['snobj2'] = $var['nobj'][0]; 37 | $var['file'] = __FILE__; 38 | $var["bin-key-\xE9"] = ''; 39 | 40 | unset($g, $r); 41 | -------------------------------------------------------------------------------- /code/vendor/symfony/var-dumper/Tests/Fixtures/Twig.php: -------------------------------------------------------------------------------- 1 | parent = false; 14 | $this->blocks = array(); 15 | $this->path = $path; 16 | } 17 | 18 | protected function doDisplay(array $context, array $blocks = array()) 19 | { 20 | // line 2 21 | throw new \Exception('Foobar'); 22 | } 23 | 24 | public function getTemplateName() 25 | { 26 | return 'foo.twig'; 27 | } 28 | 29 | public function getDebugInfo() 30 | { 31 | return array(20 => 1, 21 => 2); 32 | } 33 | 34 | public function getSourceContext() 35 | { 36 | return new Twig\Source(" foo bar\n twig source\n\n", 'foo.twig', $this->path ?: __FILE__); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /code/vendor/symfony/polyfill-mbstring/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "symfony/polyfill-mbstring", 3 | "type": "library", 4 | "description": "Symfony polyfill for the Mbstring extension", 5 | "keywords": ["polyfill", "shim", "compatibility", "portable", "mbstring"], 6 | "homepage": "https://symfony.com", 7 | "license": "MIT", 8 | "authors": [ 9 | { 10 | "name": "Nicolas Grekas", 11 | "email": "p@tchwork.com" 12 | }, 13 | { 14 | "name": "Symfony Community", 15 | "homepage": "https://symfony.com/contributors" 16 | } 17 | ], 18 | "require": { 19 | "php": ">=5.3.3" 20 | }, 21 | "autoload": { 22 | "psr-4": { "Symfony\\Polyfill\\Mbstring\\": "" }, 23 | "files": [ "bootstrap.php" ] 24 | }, 25 | "suggest": { 26 | "ext-mbstring": "For best performance" 27 | }, 28 | "minimum-stability": "dev", 29 | "extra": { 30 | "branch-alias": { 31 | "dev-master": "1.8-dev" 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /code/src/Repositories/Identify/IdentifyZhengFangColLevenshteinRepository.php: -------------------------------------------------------------------------------- 1 | 255 , 19 | 'char' => null , 20 | ]; 21 | foreach($dictionary as $key => $sample){ 22 | $percent=levenshtein($oneDChar,$sample['rowStr']); 23 | 24 | if ($percent < $nowBest['score']) { 25 | $nowBest['score'] = $percent; 26 | $nowBest['char'] = $sample['char']; 27 | } 28 | 29 | if ($nowBest['score'] < 2) { 30 | break; 31 | } 32 | } 33 | 34 | return $nowBest['char']; 35 | } 36 | 37 | } -------------------------------------------------------------------------------- /code/vendor/symfony/var-dumper/Caster/TraceStub.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\VarDumper\Caster; 13 | 14 | use Symfony\Component\VarDumper\Cloner\Stub; 15 | 16 | /** 17 | * Represents a backtrace as returned by debug_backtrace() or Exception->getTrace(). 18 | * 19 | * @author Nicolas Grekas 20 | */ 21 | class TraceStub extends Stub 22 | { 23 | public $keepArgs; 24 | public $sliceOffset; 25 | public $sliceLength; 26 | public $numberingOffset; 27 | 28 | public function __construct(array $trace, $keepArgs = true, $sliceOffset = 0, $sliceLength = null, $numberingOffset = 0) 29 | { 30 | $this->value = $trace; 31 | $this->keepArgs = $keepArgs; 32 | $this->sliceOffset = $sliceOffset; 33 | $this->sliceLength = $sliceLength; 34 | $this->numberingOffset = $numberingOffset; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /code/vendor/symfony/var-dumper/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2014-2018 Fabien Potencier 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is furnished 8 | to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all 11 | copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /code/vendor/symfony/var-dumper/phpunit.xml.dist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | ./Tests/ 20 | 21 | 22 | 23 | 24 | 25 | ./ 26 | 27 | ./Resources 28 | ./Tests 29 | ./vendor 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /code/vendor/composer/LICENSE: -------------------------------------------------------------------------------- 1 | 2 | Copyright (c) Nils Adermann, Jordi Boggiano 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to deal 6 | in the Software without restriction, including without limitation the rights 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the Software is furnished 9 | to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in all 12 | copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | THE SOFTWARE. 21 | 22 | -------------------------------------------------------------------------------- /code/vendor/symfony/polyfill-mbstring/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2015-2018 Fabien Potencier 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is furnished 8 | to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all 11 | copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /code/vendor/symfony/var-dumper/Tests/Test/VarDumperTestTraitTest.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\VarDumper\Tests\Test; 13 | 14 | use PHPUnit\Framework\TestCase; 15 | use Symfony\Component\VarDumper\Test\VarDumperTestTrait; 16 | 17 | class VarDumperTestTraitTest extends TestCase 18 | { 19 | use VarDumperTestTrait; 20 | 21 | public function testItComparesLargeData() 22 | { 23 | $howMany = 700; 24 | $data = array_fill_keys(range(0, $howMany), array('a', 'b', 'c', 'd')); 25 | 26 | $expected = sprintf("array:%d [\n", $howMany + 1); 27 | for ($i = 0; $i <= $howMany; ++$i) { 28 | $expected .= << array:4 [ 30 | 0 => "a" 31 | 1 => "b" 32 | 2 => "c" 33 | 3 => "d" 34 | ]\n 35 | EODUMP; 36 | } 37 | $expected .= "]\n"; 38 | 39 | $this->assertDumpEquals($expected, $data); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /code/vendor/symfony/var-dumper/Caster/MongoCaster.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\VarDumper\Caster; 13 | 14 | use Symfony\Component\VarDumper\Cloner\Stub; 15 | 16 | @trigger_error('The '.__NAMESPACE__.'\MongoCaster class is deprecated since Symfony 3.4 and will be removed in 4.0.', E_USER_DEPRECATED); 17 | 18 | /** 19 | * Casts classes from the MongoDb extension to array representation. 20 | * 21 | * @author Nicolas Grekas 22 | * 23 | * @deprecated since version 3.4, to be removed in 4.0. 24 | */ 25 | class MongoCaster 26 | { 27 | public static function castCursor(\MongoCursorInterface $cursor, array $a, Stub $stub, $isNested) 28 | { 29 | if ($info = $cursor->info()) { 30 | foreach ($info as $k => $v) { 31 | $a[Caster::PREFIX_VIRTUAL.$k] = $v; 32 | } 33 | } 34 | $a[Caster::PREFIX_VIRTUAL.'dead'] = $cursor->dead(); 35 | 36 | return $a; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /code/vendor/symfony/var-dumper/Cloner/Cursor.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\VarDumper\Cloner; 13 | 14 | /** 15 | * Represents the current state of a dumper while dumping. 16 | * 17 | * @author Nicolas Grekas 18 | */ 19 | class Cursor 20 | { 21 | const HASH_INDEXED = Stub::ARRAY_INDEXED; 22 | const HASH_ASSOC = Stub::ARRAY_ASSOC; 23 | const HASH_OBJECT = Stub::TYPE_OBJECT; 24 | const HASH_RESOURCE = Stub::TYPE_RESOURCE; 25 | 26 | public $depth = 0; 27 | public $refIndex = 0; 28 | public $softRefTo = 0; 29 | public $softRefCount = 0; 30 | public $softRefHandle = 0; 31 | public $hardRefTo = 0; 32 | public $hardRefCount = 0; 33 | public $hardRefHandle = 0; 34 | public $hashType; 35 | public $hashKey; 36 | public $hashKeyIsBinary; 37 | public $hashIndex = 0; 38 | public $hashLength = 0; 39 | public $hashCut = 0; 40 | public $stop = false; 41 | public $attr = array(); 42 | public $skipChildren = false; 43 | } 44 | -------------------------------------------------------------------------------- /code/vendor/symfony/var-dumper/Caster/SymfonyCaster.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\VarDumper\Caster; 13 | 14 | use Symfony\Component\HttpFoundation\Request; 15 | use Symfony\Component\VarDumper\Cloner\Stub; 16 | 17 | class SymfonyCaster 18 | { 19 | private static $requestGetters = array( 20 | 'pathInfo' => 'getPathInfo', 21 | 'requestUri' => 'getRequestUri', 22 | 'baseUrl' => 'getBaseUrl', 23 | 'basePath' => 'getBasePath', 24 | 'method' => 'getMethod', 25 | 'format' => 'getRequestFormat', 26 | ); 27 | 28 | public static function castRequest(Request $request, array $a, Stub $stub, $isNested) 29 | { 30 | $clone = null; 31 | 32 | foreach (self::$requestGetters as $prop => $getter) { 33 | if (null === $a[Caster::PREFIX_PROTECTED.$prop]) { 34 | if (null === $clone) { 35 | $clone = clone $request; 36 | } 37 | $a[Caster::PREFIX_VIRTUAL.$prop] = $clone->{$getter}(); 38 | } 39 | } 40 | 41 | return $a; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /code/src/Trait/CommonTrait.php: -------------------------------------------------------------------------------- 1 | $resY){ 42 | echo $key; 43 | if (strlen( $key ) == 1) { 44 | echo ' '; 45 | } 46 | foreach($resY as $resX){ 47 | $resX ? $output = 'l ' : $output = '_ '; 48 | echo $output; 49 | } 50 | echo "\n"; 51 | 52 | } 53 | echo "\n"; 54 | } 55 | 56 | 57 | 58 | 59 | } 60 | -------------------------------------------------------------------------------- /code/src/Log/Log.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\VarDumper; 13 | 14 | use Symfony\Component\VarDumper\Cloner\VarCloner; 15 | use Symfony\Component\VarDumper\Dumper\CliDumper; 16 | use Symfony\Component\VarDumper\Dumper\HtmlDumper; 17 | 18 | // Load the global dump() function 19 | require_once __DIR__.'/Resources/functions/dump.php'; 20 | 21 | /** 22 | * @author Nicolas Grekas 23 | */ 24 | class VarDumper 25 | { 26 | private static $handler; 27 | 28 | public static function dump($var) 29 | { 30 | if (null === self::$handler) { 31 | $cloner = new VarCloner(); 32 | $dumper = \in_array(PHP_SAPI, array('cli', 'phpdbg'), true) ? new CliDumper() : new HtmlDumper(); 33 | self::$handler = function ($var) use ($cloner, $dumper) { 34 | $dumper->dump($cloner->cloneVar($var)); 35 | }; 36 | } 37 | 38 | return call_user_func(self::$handler, $var); 39 | } 40 | 41 | public static function setHandler(callable $callable = null) 42 | { 43 | $prevHandler = self::$handler; 44 | self::$handler = $callable; 45 | 46 | return $prevHandler; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /code/vendor/symfony/var-dumper/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "symfony/var-dumper", 3 | "type": "library", 4 | "description": "Symfony mechanism for exploring and dumping PHP variables", 5 | "keywords": ["dump", "debug"], 6 | "homepage": "https://symfony.com", 7 | "license": "MIT", 8 | "authors": [ 9 | { 10 | "name": "Nicolas Grekas", 11 | "email": "p@tchwork.com" 12 | }, 13 | { 14 | "name": "Symfony Community", 15 | "homepage": "https://symfony.com/contributors" 16 | } 17 | ], 18 | "require": { 19 | "php": "^5.5.9|>=7.0.8", 20 | "symfony/polyfill-mbstring": "~1.0" 21 | }, 22 | "require-dev": { 23 | "ext-iconv": "*", 24 | "twig/twig": "~1.34|~2.4" 25 | }, 26 | "conflict": { 27 | "phpunit/phpunit": "<4.8.35|<5.4.3,>=5.0" 28 | }, 29 | "suggest": { 30 | "ext-iconv": "To convert non-UTF-8 strings to UTF-8 (or symfony/polyfill-iconv in case ext-iconv cannot be used).", 31 | "ext-intl": "To show region name in time zone dump", 32 | "ext-symfony_debug": "" 33 | }, 34 | "autoload": { 35 | "files": [ "Resources/functions/dump.php" ], 36 | "psr-4": { "Symfony\\Component\\VarDumper\\": "" }, 37 | "exclude-from-classmap": [ 38 | "/Tests/" 39 | ] 40 | }, 41 | "minimum-stability": "dev", 42 | "extra": { 43 | "branch-alias": { 44 | "dev-master": "3.4-dev" 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /code/src/App/GetImageInfo/GetImageInfo.php: -------------------------------------------------------------------------------- 1 | resultContainer = $resultContainer; 26 | $this->conf = $this->resultContainer->getConf(); 27 | $mode = $this->resultContainer->getMode(); 28 | $imagePath = $this->resultContainer->getImagePath(); 29 | //获取 图片和图片信息 30 | if ($mode == 'online') { 31 | $imagePath = $this->downLoadOnlineImage( $imagePath ); 32 | } 33 | $this->resultContainer->imageurl = $imagePath; 34 | $imageAndInfo = $this->getImageAndInfo( $imagePath ); 35 | 36 | //将结果存入容器 37 | $this->resultContainer->setImageInfo( $imageAndInfo['info'] ); 38 | $this->resultContainer->setImage( $imageAndInfo['image'] ); 39 | 40 | //-------------------------------------------- 41 | $this->resultContainer = $this->nextStep->run( $this->resultContainer ); 42 | 43 | //-------------------------------------------- 44 | return $this->resultContainer; 45 | } 46 | 47 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # 小程序版本定制已出(效果截图在下方,欢迎定制或购买小程序) 2 | 3 | ## 因为正方系统每个版本的数据不一致,所以成绩查询开源会导致某些学校用不了,建议找本人私人定制,定制教务系统各种功能(查课表,绑定微信等) 个人QQ:1194174530 4 | 5 | ### 有高校需要教务小程序的或者想合作的可以联系下我,自主研发的教务小程序,上线一年多期间有1.6W用户使用,150W的访问量,是运营校园应用的首选,支持高校定制,如需了解详情请加qq:1194174530 6 | 7 | 8 | ## 正方教务系统成绩查询手机版,结合Weui,自动识别验证码,通过模拟请求抓取教务系统成绩信息 9 | 10 | ### 正方教务系统成绩查询 2.0 版本,好用的话可以推荐其他高校的朋友使用,记得给个给个Star 11 | 12 | >请认真查看下面的说明: 13 | 14 | 版本要求:PHP版本建议在5.6以上, 15 | 务必安装curl扩展,否则无法使用curl等方法, 16 | ps:5.6版本以下默认关闭识别验证码,如验证码显示不了或者识别失败,请更换php版本试试 17 | 18 | >使用方法:修改code/captcha.php文件的IP地址即可 19 | 20 | >更新内容 21 | 22 | * 重构目录及源码等规范,方便扩展与阅读; 23 | 24 | * 新增自动识别验证码,准确率在87%; 25 | 26 | * 新增日期选项自动填充 27 | 28 | * 新增通过Cookie保存用户名,有效期30天; 29 | 30 | >项目演示地址:http://cj.kbteam.cn/ 31 | 32 | >项目截图 33 | 34 | ![image](https://github.com/kbdxbt/cj/raw/2.0/image/1.png) 35 | ![image](https://github.com/kbdxbt/cj/raw/2.0/image/2.png) 36 | ![image](https://github.com/kbdxbt/cj/raw/2.0/image/3.png) 37 | ![image](https://github.com/kbdxbt/cj/raw/2.0/image/4.png) 38 | ![image](https://github.com/kbdxbt/cj/raw/2.0/image/5.png) 39 | ![image](https://github.com/kbdxbt/cj/raw/2.0/image/6.png) 40 | ![image](https://github.com/kbdxbt/cj/raw/2.0/image/7.png) 41 | ![image](https://github.com/kbdxbt/cj/raw/2.0/image/8.png) 42 | ![image](https://github.com/kbdxbt/cj/raw/2.0/image/9.png) 43 | ![image](https://github.com/kbdxbt/cj/raw/2.0/image/10.png) 44 | ![image](https://github.com/kbdxbt/cj/raw/2.0/image/11.png) 45 | ![image](https://github.com/kbdxbt/cj/raw/2.0/image/12.png) 46 | ![image](https://github.com/kbdxbt/cj/raw/2.0/image/13.png) 47 | 48 | -------------------------------------------------------------------------------- /code/src/Config/app.php: -------------------------------------------------------------------------------- 1 | 'ZhengFangNormal' , 20 | 21 | /* 22 | |-------------------------------------------------------------------------- 23 | | componentGroup 24 | |-------------------------------------------------------------------------- 25 | | 设定的组件模组 26 | */ 27 | 28 | 'componentGroup' => [ 29 | 'ZhengFangNormal' => [ 30 | 'components' => [ 31 | \CAPTCHAReader\src\App\GetImageInfo\GetImageInfo::class , 32 | \CAPTCHAReader\src\App\Pretreatment\PretreatmentZhengFang::class , 33 | \CAPTCHAReader\src\App\Cutting\CuttingZhengFangFixed::class , 34 | \CAPTCHAReader\src\App\Identify\IdentifyZhengFangColLevenshtein::class , 35 | ] , 36 | 'dictionary' => 'GetImageInfo-PretreatmentZhengFang-CuttingZhengFangFixed-IdentifyZhengFangColLevenshtein.json' , 37 | ] , 38 | ] , 39 | 40 | /* 41 | |-------------------------------------------------------------------------- 42 | | note detail judge process 43 | |-------------------------------------------------------------------------- 44 | | 45 | | 是否记录比较过程 46 | | 47 | */ 48 | 49 | 'noteDetailJudgeProcess' => true , 50 | 51 | ]; -------------------------------------------------------------------------------- /code/src/Trait/GetImageInfoTrait.php: -------------------------------------------------------------------------------- 1 | getTmpSampleSavePath() . str_replace( [' ' , '.'] , '' , microtime() ).'.' ; 22 | $content = file_get_contents( $path ); 23 | $save_to .= image_type_to_extension( getimagesizefromstring( $content )[2] , false ); 24 | file_put_contents( $save_to , $content ); 25 | return $save_to; 26 | } 27 | 28 | /** 29 | * @return mixed 30 | */ 31 | public function getTmpSampleSavePath(){ 32 | $sampleConfig = $this->getConfig( 'sample' ); 33 | return $sampleConfig['tmpSampleSavePath']; 34 | } 35 | 36 | /** 37 | * @param $imagePath 38 | * @return array 39 | */ 40 | public function getImageAndInfo($imagePath){ 41 | $_info = getimagesize( $imagePath ); 42 | $info = array( 43 | 'width' => $_info[0] , 44 | 'height' => $_info[1] , 45 | 'type' => image_type_to_extension( $_info[2] , false ) , 46 | 'mime' => $_info['mime'] 47 | ); 48 | 49 | //根据上面获取的格式判定应该使用哪种 imagecreatefrom*** 函数 50 | $fun = "imagecreatefrom{$info['type']}"; 51 | $image = $fun( $imagePath ); 52 | return compact( 'image' , 'info' ); 53 | } 54 | 55 | 56 | 57 | } -------------------------------------------------------------------------------- /code/vendor/symfony/var-dumper/Cloner/Stub.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\VarDumper\Cloner; 13 | 14 | /** 15 | * Represents the main properties of a PHP variable. 16 | * 17 | * @author Nicolas Grekas 18 | */ 19 | class Stub implements \Serializable 20 | { 21 | const TYPE_REF = 1; 22 | const TYPE_STRING = 2; 23 | const TYPE_ARRAY = 3; 24 | const TYPE_OBJECT = 4; 25 | const TYPE_RESOURCE = 5; 26 | 27 | const STRING_BINARY = 1; 28 | const STRING_UTF8 = 2; 29 | 30 | const ARRAY_ASSOC = 1; 31 | const ARRAY_INDEXED = 2; 32 | 33 | public $type = self::TYPE_REF; 34 | public $class = ''; 35 | public $value; 36 | public $cut = 0; 37 | public $handle = 0; 38 | public $refCount = 0; 39 | public $position = 0; 40 | public $attr = array(); 41 | 42 | /** 43 | * @internal 44 | */ 45 | public function serialize() 46 | { 47 | return \serialize(array($this->class, $this->position, $this->cut, $this->type, $this->value, $this->handle, $this->refCount, $this->attr)); 48 | } 49 | 50 | /** 51 | * @internal 52 | */ 53 | public function unserialize($serialized) 54 | { 55 | list($this->class, $this->position, $this->cut, $this->type, $this->value, $this->handle, $this->refCount, $this->attr) = \unserialize($serialized); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /code/vendor/symfony/var-dumper/Caster/DoctrineCaster.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\VarDumper\Caster; 13 | 14 | use Doctrine\Common\Proxy\Proxy as CommonProxy; 15 | use Doctrine\ORM\Proxy\Proxy as OrmProxy; 16 | use Doctrine\ORM\PersistentCollection; 17 | use Symfony\Component\VarDumper\Cloner\Stub; 18 | 19 | /** 20 | * Casts Doctrine related classes to array representation. 21 | * 22 | * @author Nicolas Grekas 23 | */ 24 | class DoctrineCaster 25 | { 26 | public static function castCommonProxy(CommonProxy $proxy, array $a, Stub $stub, $isNested) 27 | { 28 | foreach (array('__cloner__', '__initializer__') as $k) { 29 | if (array_key_exists($k, $a)) { 30 | unset($a[$k]); 31 | ++$stub->cut; 32 | } 33 | } 34 | 35 | return $a; 36 | } 37 | 38 | public static function castOrmProxy(OrmProxy $proxy, array $a, Stub $stub, $isNested) 39 | { 40 | foreach (array('_entityPersister', '_identifier') as $k) { 41 | if (array_key_exists($k = "\0Doctrine\\ORM\\Proxy\\Proxy\0".$k, $a)) { 42 | unset($a[$k]); 43 | ++$stub->cut; 44 | } 45 | } 46 | 47 | return $a; 48 | } 49 | 50 | public static function castPersistentCollection(PersistentCollection $coll, array $a, Stub $stub, $isNested) 51 | { 52 | foreach (array('snapshot', 'association', 'typeClass') as $k) { 53 | if (array_key_exists($k = "\0Doctrine\\ORM\\PersistentCollection\0".$k, $a)) { 54 | $a[$k] = new CutStub($a[$k]); 55 | } 56 | } 57 | 58 | return $a; 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /code/vendor/symfony/var-dumper/Tests/Caster/RedisCasterTest.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\VarDumper\Tests\Caster; 13 | 14 | use PHPUnit\Framework\TestCase; 15 | use Symfony\Component\VarDumper\Test\VarDumperTestTrait; 16 | 17 | /** 18 | * @author Nicolas Grekas 19 | * @requires extension redis 20 | */ 21 | class RedisCasterTest extends TestCase 22 | { 23 | use VarDumperTestTrait; 24 | 25 | public function testNotConnected() 26 | { 27 | $redis = new \Redis(); 28 | 29 | if (defined('HHVM_VERSION_ID')) { 30 | $xCast = <<<'EODUMP' 31 | Redis { 32 | #host: "" 33 | %A 34 | } 35 | EODUMP; 36 | } else { 37 | $xCast = <<<'EODUMP' 38 | Redis { 39 | isConnected: false 40 | } 41 | EODUMP; 42 | } 43 | 44 | $this->assertDumpMatchesFormat($xCast, $redis); 45 | } 46 | 47 | public function testConnected() 48 | { 49 | $redis = new \Redis(); 50 | if (!@$redis->connect('127.0.0.1')) { 51 | $e = error_get_last(); 52 | self::markTestSkipped($e['message']); 53 | } 54 | 55 | if (defined('HHVM_VERSION_ID')) { 56 | $xCast = <<<'EODUMP' 57 | Redis { 58 | #host: "127.0.0.1" 59 | %A 60 | } 61 | EODUMP; 62 | } else { 63 | $xCast = <<<'EODUMP' 64 | Redis {%A 65 | isConnected: true 66 | host: "127.0.0.1" 67 | port: 6379 68 | auth: null 69 | dbNum: 0 70 | timeout: 0.0 71 | persistentId: null 72 | options: { 73 | READ_TIMEOUT: 0.0 74 | SERIALIZER: NONE 75 | PREFIX: null 76 | SCAN: NORETRY 77 | } 78 | } 79 | EODUMP; 80 | } 81 | 82 | $this->assertDumpMatchesFormat($xCast, $redis); 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /code/captcha.php: -------------------------------------------------------------------------------- 1 | entrance($imgurl, 'online'); 64 | 65 | //当前网站地址目录 66 | $url = dirname("http://".$_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"]); 67 | 68 | //图片地址 69 | $image = rtrim($url.'/sample/TempSamples/'.pathinfo($app->image, PATHINFO_BASENAME), '/'); 70 | 71 | } 72 | 73 | //删除识别的验证码 1/50的概率触发 74 | (!(rand(1, 50) == '6')) ? : del_dir('sample/TempSamples/'); 75 | (!(rand(1, 50) == '6')) ? : del_dir('cache/'); 76 | 77 | //返回json数据 78 | exit(json_encode(['captcha'=>$captcha, 'image'=>$image])); 79 | 80 | -------------------------------------------------------------------------------- /code/vendor/symfony/var-dumper/Caster/CutStub.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\VarDumper\Caster; 13 | 14 | use Symfony\Component\VarDumper\Cloner\Stub; 15 | 16 | /** 17 | * Represents the main properties of a PHP variable, pre-casted by a caster. 18 | * 19 | * @author Nicolas Grekas 20 | */ 21 | class CutStub extends Stub 22 | { 23 | public function __construct($value) 24 | { 25 | $this->value = $value; 26 | 27 | switch (gettype($value)) { 28 | case 'object': 29 | $this->type = self::TYPE_OBJECT; 30 | $this->class = get_class($value); 31 | $this->cut = -1; 32 | break; 33 | 34 | case 'array': 35 | $this->type = self::TYPE_ARRAY; 36 | $this->class = self::ARRAY_ASSOC; 37 | $this->cut = $this->value = count($value); 38 | break; 39 | 40 | case 'resource': 41 | case 'unknown type': 42 | case 'resource (closed)': 43 | $this->type = self::TYPE_RESOURCE; 44 | $this->handle = (int) $value; 45 | if ('Unknown' === $this->class = @get_resource_type($value)) { 46 | $this->class = 'Closed'; 47 | } 48 | $this->cut = -1; 49 | break; 50 | 51 | case 'string': 52 | $this->type = self::TYPE_STRING; 53 | $this->class = preg_match('//u', $value) ? self::STRING_UTF8 : self::STRING_BINARY; 54 | $this->cut = self::STRING_BINARY === $this->class ? strlen($value) : mb_strlen($value, 'UTF-8'); 55 | $this->value = ''; 56 | break; 57 | } 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /code/vendor/symfony/var-dumper/Tests/Caster/PdoCasterTest.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\VarDumper\Tests\Caster; 13 | 14 | use PHPUnit\Framework\TestCase; 15 | use Symfony\Component\VarDumper\Caster\PdoCaster; 16 | use Symfony\Component\VarDumper\Cloner\Stub; 17 | use Symfony\Component\VarDumper\Test\VarDumperTestTrait; 18 | 19 | /** 20 | * @author Nicolas Grekas 21 | */ 22 | class PdoCasterTest extends TestCase 23 | { 24 | use VarDumperTestTrait; 25 | 26 | /** 27 | * @requires extension pdo_sqlite 28 | */ 29 | public function testCastPdo() 30 | { 31 | $pdo = new \PDO('sqlite::memory:'); 32 | $pdo->setAttribute(\PDO::ATTR_STATEMENT_CLASS, array('PDOStatement', array($pdo))); 33 | 34 | $cast = PdoCaster::castPdo($pdo, array(), new Stub(), false); 35 | 36 | $this->assertInstanceOf('Symfony\Component\VarDumper\Caster\EnumStub', $cast["\0~\0attributes"]); 37 | 38 | $attr = $cast["\0~\0attributes"] = $cast["\0~\0attributes"]->value; 39 | $this->assertInstanceOf('Symfony\Component\VarDumper\Caster\ConstStub', $attr['CASE']); 40 | $this->assertSame('NATURAL', $attr['CASE']->class); 41 | $this->assertSame('BOTH', $attr['DEFAULT_FETCH_MODE']->class); 42 | 43 | $xDump = <<<'EODUMP' 44 | array:2 [ 45 | "\x00~\x00inTransaction" => false 46 | "\x00~\x00attributes" => array:9 [ 47 | "CASE" => NATURAL 48 | "ERRMODE" => SILENT 49 | "PERSISTENT" => false 50 | "DRIVER_NAME" => "sqlite" 51 | "ORACLE_NULLS" => NATURAL 52 | "CLIENT_VERSION" => "%s" 53 | "SERVER_VERSION" => "%s" 54 | "STATEMENT_CLASS" => array:%d [ 55 | 0 => "PDOStatement"%A 56 | ] 57 | "DEFAULT_FETCH_MODE" => BOTH 58 | ] 59 | ] 60 | EODUMP; 61 | 62 | $this->assertDumpMatchesFormat($xDump, $cast); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /code/vendor/symfony/var-dumper/Caster/ResourceCaster.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\VarDumper\Caster; 13 | 14 | use Symfony\Component\VarDumper\Cloner\Stub; 15 | 16 | /** 17 | * Casts common resource types to array representation. 18 | * 19 | * @author Nicolas Grekas 20 | */ 21 | class ResourceCaster 22 | { 23 | public static function castCurl($h, array $a, Stub $stub, $isNested) 24 | { 25 | return curl_getinfo($h); 26 | } 27 | 28 | public static function castDba($dba, array $a, Stub $stub, $isNested) 29 | { 30 | $list = dba_list(); 31 | $a['file'] = $list[(int) $dba]; 32 | 33 | return $a; 34 | } 35 | 36 | public static function castProcess($process, array $a, Stub $stub, $isNested) 37 | { 38 | return proc_get_status($process); 39 | } 40 | 41 | public static function castStream($stream, array $a, Stub $stub, $isNested) 42 | { 43 | $a = stream_get_meta_data($stream) + static::castStreamContext($stream, $a, $stub, $isNested); 44 | if (isset($a['uri'])) { 45 | $a['uri'] = new LinkStub($a['uri']); 46 | } 47 | 48 | return $a; 49 | } 50 | 51 | public static function castStreamContext($stream, array $a, Stub $stub, $isNested) 52 | { 53 | return @stream_context_get_params($stream) ?: $a; 54 | } 55 | 56 | public static function castGd($gd, array $a, Stub $stub, $isNested) 57 | { 58 | $a['size'] = imagesx($gd).'x'.imagesy($gd); 59 | $a['trueColor'] = imageistruecolor($gd); 60 | 61 | return $a; 62 | } 63 | 64 | public static function castMysqlLink($h, array $a, Stub $stub, $isNested) 65 | { 66 | $a['host'] = mysql_get_host_info($h); 67 | $a['protocol'] = mysql_get_proto_info($h); 68 | $a['server'] = mysql_get_server_info($h); 69 | 70 | return $a; 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /code/src/App/Pretreatment/PretreatmentZhengFang.php: -------------------------------------------------------------------------------- 1 | pretreatmentRepository = $this->getRepository('ZhengFang'); 32 | } 33 | 34 | /** 35 | * @param ResultContainer $resultContainer 36 | * @return mixed 37 | */ 38 | function run( ResultContainer $resultContainer ){ 39 | $this->resultContainer = $resultContainer; 40 | $this->conf = $this->resultContainer->getConf(); 41 | 42 | $imageInfo = $this->resultContainer->getImageInfo(); 43 | $image = $this->resultContainer->getImage(); 44 | 45 | //二值化 46 | $imageBinaryArr = $this->pretreatmentRepository->binarization( $imageInfo['width'] , $imageInfo['height'] , $image ); 47 | 48 | //去掉散点 49 | $noiseCancelArr = $this->pretreatmentRepository->SimpleNoiseCancel( $imageInfo['width'] , $imageInfo['height'] , $imageBinaryArr ); 50 | 51 | $this->resultContainer->unsetImage(); 52 | $this->resultContainer->setImageBinaryArr( $imageBinaryArr ); 53 | $this->resultContainer->setNoiseCancelArr( $noiseCancelArr ); 54 | //------------------------------------------------------------------ 55 | $this->resultContainer=$this->nextStep->run($this->resultContainer); 56 | //------------------------------------------------------------------ 57 | return $this->resultContainer; 58 | } 59 | 60 | 61 | } -------------------------------------------------------------------------------- /code/src/App/Identify/IdentifyZhengFangCol.php: -------------------------------------------------------------------------------- 1 | identifyRepository = $this->getRepository('ZhengFangCol'); 31 | } 32 | 33 | function run(ResultContainer $resultContainer) 34 | { 35 | $this->resultContainer = $resultContainer; 36 | $this->conf = $this->resultContainer->getConf(); 37 | $this->charPixedCollection = $this->resultContainer->getCharPixedCollection(); 38 | 39 | $this->dictionary = $this->getDictionary($this->conf['componentGroup'][$this->conf['useGroup']]['dictionary']); 40 | 41 | //空字典处理 42 | if (!count($this->dictionary)) { 43 | $this->resultContainer->setResultStr(null); 44 | return $this->resultContainer; 45 | } 46 | 47 | //将 数组 转为 字符串 48 | foreach ($this->charPixedCollection as $charPixed) { 49 | $oneDCharStrArr[] = $this->twoD2oneDArrayCol($charPixed); 50 | } 51 | 52 | $this->resultContainer->setOneDCharStrArr($oneDCharStrArr); 53 | 54 | //在 字典中 寻找 相似度 最高的 样本 55 | $result = ''; 56 | foreach($oneDCharStrArr as $oneDChar){ 57 | //是否记录识别详情 58 | if ($this->conf['noteDetailJudgeProcess']) { 59 | $result .= $this->identifyRepository->getHighestSimilarityResultNoteDetail( $oneDChar , $this->dictionary , $this->resultContainer ); 60 | } else { 61 | $result .= $this->identifyRepository->getHighestSimilarityResult( $oneDChar , $this->dictionary ); 62 | } 63 | } 64 | 65 | $this->resultContainer->setResultStr($result); 66 | 67 | return $this->resultContainer; 68 | } 69 | } -------------------------------------------------------------------------------- /code/src/App/Identify/IdentifyZhengFangColLevenshtein.php: -------------------------------------------------------------------------------- 1 | identifyRepository = $this->getRepository('ZhengFangColLevenshtein'); 31 | } 32 | 33 | function run(ResultContainer $resultContainer) 34 | { 35 | $this->resultContainer = $resultContainer; 36 | $this->conf = $this->resultContainer->getConf(); 37 | $this->charPixedCollection = $this->resultContainer->getCharPixedCollection(); 38 | 39 | $this->dictionary = $this->getDictionary($this->conf['componentGroup'][$this->conf['useGroup']]['dictionary']); 40 | 41 | //将 数组 转为 字符串 42 | foreach ($this->charPixedCollection as $charPixed) { 43 | $oneDCharStrArr[] = $this->twoD2oneDArrayCol($charPixed); 44 | } 45 | 46 | $this->resultContainer->setOneDCharStrArr($oneDCharStrArr); 47 | 48 | //异常处理 49 | if (!count($this->dictionary)) { 50 | $this->resultContainer->setResultStr(null); 51 | return $this->resultContainer; 52 | } 53 | 54 | //在 字典中 寻找 相似度 最高的 样本 55 | $result = ''; 56 | foreach($oneDCharStrArr as $oneDChar){ 57 | //是否记录识别详情 58 | if ($this->conf['noteDetailJudgeProcess']) { 59 | $result .= $this->identifyRepository->getHighestSimilarityResultLevenshtein( $oneDChar , $this->dictionary , $this->resultContainer ); 60 | } else { 61 | $result .= $this->identifyRepository->getHighestSimilarityResult( $oneDChar , $this->dictionary ); 62 | } 63 | } 64 | 65 | $this->resultContainer->setResultStr($result); 66 | 67 | return $this->resultContainer; 68 | } 69 | 70 | 71 | } -------------------------------------------------------------------------------- /code/vendor/symfony/var-dumper/Cloner/DumperInterface.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\VarDumper\Cloner; 13 | 14 | /** 15 | * DumperInterface used by Data objects. 16 | * 17 | * @author Nicolas Grekas 18 | */ 19 | interface DumperInterface 20 | { 21 | /** 22 | * Dumps a scalar value. 23 | * 24 | * @param Cursor $cursor The Cursor position in the dump 25 | * @param string $type The PHP type of the value being dumped 26 | * @param string|int|float|bool $value The scalar value being dumped 27 | */ 28 | public function dumpScalar(Cursor $cursor, $type, $value); 29 | 30 | /** 31 | * Dumps a string. 32 | * 33 | * @param Cursor $cursor The Cursor position in the dump 34 | * @param string $str The string being dumped 35 | * @param bool $bin Whether $str is UTF-8 or binary encoded 36 | * @param int $cut The number of characters $str has been cut by 37 | */ 38 | public function dumpString(Cursor $cursor, $str, $bin, $cut); 39 | 40 | /** 41 | * Dumps while entering an hash. 42 | * 43 | * @param Cursor $cursor The Cursor position in the dump 44 | * @param int $type A Cursor::HASH_* const for the type of hash 45 | * @param string $class The object class, resource type or array count 46 | * @param bool $hasChild When the dump of the hash has child item 47 | */ 48 | public function enterHash(Cursor $cursor, $type, $class, $hasChild); 49 | 50 | /** 51 | * Dumps while leaving an hash. 52 | * 53 | * @param Cursor $cursor The Cursor position in the dump 54 | * @param int $type A Cursor::HASH_* const for the type of hash 55 | * @param string $class The object class, resource type or array count 56 | * @param bool $hasChild When the dump of the hash has child item 57 | * @param int $cut The number of items the hash has been cut by 58 | */ 59 | public function leaveHash(Cursor $cursor, $type, $class, $hasChild, $cut); 60 | } 61 | -------------------------------------------------------------------------------- /code/vendor/symfony/var-dumper/Test/VarDumperTestTrait.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\VarDumper\Test; 13 | 14 | use Symfony\Component\VarDumper\Cloner\VarCloner; 15 | use Symfony\Component\VarDumper\Dumper\CliDumper; 16 | 17 | /** 18 | * @author Nicolas Grekas 19 | */ 20 | trait VarDumperTestTrait 21 | { 22 | public function assertDumpEquals($dump, $data, $filter = 0, $message = '') 23 | { 24 | if (is_string($filter)) { 25 | @trigger_error(sprintf('The $message argument of the "%s()" method at 3rd position is deprecated since Symfony 3.4 and will be moved at 4th position in 4.0.', __METHOD__), E_USER_DEPRECATED); 26 | $message = $filter; 27 | $filter = 0; 28 | } 29 | 30 | $this->assertSame(rtrim($dump), $this->getDump($data, null, $filter), $message); 31 | } 32 | 33 | public function assertDumpMatchesFormat($dump, $data, $filter = 0, $message = '') 34 | { 35 | if (is_string($filter)) { 36 | @trigger_error(sprintf('The $message argument of the "%s()" method at 3rd position is deprecated since Symfony 3.4 and will be moved at 4th position in 4.0.', __METHOD__), E_USER_DEPRECATED); 37 | $message = $filter; 38 | $filter = 0; 39 | } 40 | 41 | $this->assertStringMatchesFormat(rtrim($dump), $this->getDump($data, null, $filter), $message); 42 | } 43 | 44 | protected function getDump($data, $key = null, $filter = 0) 45 | { 46 | $flags = getenv('DUMP_LIGHT_ARRAY') ? CliDumper::DUMP_LIGHT_ARRAY : 0; 47 | $flags |= getenv('DUMP_STRING_LENGTH') ? CliDumper::DUMP_STRING_LENGTH : 0; 48 | 49 | $cloner = new VarCloner(); 50 | $cloner->setMaxItems(-1); 51 | $dumper = new CliDumper(null, null, $flags); 52 | $dumper->setColors(false); 53 | $data = $cloner->cloneVar($data, $filter)->withRefHandles(false); 54 | if (null !== $key && null === $data = $data->seek($key)) { 55 | return; 56 | } 57 | 58 | return rtrim($dumper->dump($data, true)); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /code/src/Trait/IdentifyTrait.php: -------------------------------------------------------------------------------- 1 | 0 , 25 | 'char' => null , 26 | ]; 27 | foreach($dictionary as $key => $sample){ 28 | similar_text( $oneDChar , $sample['rowStr'] , $percent ); 29 | $flag = 0; 30 | if ($percent > $nowBest['score']) { 31 | $nowBest['score'] = $percent; 32 | $nowBest['char'] = $sample['char']; 33 | $flag = 1; 34 | } 35 | $judge = [ 36 | 'percent' => $percent , 37 | 'char' => $sample['char'] , 38 | 'sampleRowStr' => $sample['rowStr'] , 39 | 'oneDChar' => $oneDChar , 40 | 'upScore' => $flag ? true : false , 41 | ]; 42 | $resultContainer->setJudgeDetails( $key , $judge ); 43 | 44 | if ($nowBest['score'] > 97) { 45 | break; 46 | } 47 | } 48 | $resultContainer->setResultArr( $nowBest ); 49 | 50 | return $nowBest['char']; 51 | } 52 | 53 | /** 54 | * @param $oneDChar 55 | * @param $dictionary 56 | * @return mixed 57 | */ 58 | public function getHighestSimilarityResult( $oneDChar , $dictionary ){ 59 | $nowBest = [ 60 | 'score' => 0 , 61 | 'char' => null , 62 | ]; 63 | foreach($dictionary as $key => $sample){ 64 | similar_text( $oneDChar , $sample['rowStr'] , $percent ); 65 | if ($percent > $nowBest['score']) { 66 | $nowBest['score'] = $percent; 67 | $nowBest['char'] = $sample['char']; 68 | } 69 | 70 | if ($nowBest['score'] > 96) { 71 | break; 72 | } 73 | } 74 | 75 | return $nowBest['char']; 76 | } 77 | 78 | 79 | } -------------------------------------------------------------------------------- /code/vendor/symfony/var-dumper/Caster/StubCaster.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\VarDumper\Caster; 13 | 14 | use Symfony\Component\VarDumper\Cloner\Stub; 15 | 16 | /** 17 | * Casts a caster's Stub. 18 | * 19 | * @author Nicolas Grekas 20 | */ 21 | class StubCaster 22 | { 23 | public static function castStub(Stub $c, array $a, Stub $stub, $isNested) 24 | { 25 | if ($isNested) { 26 | $stub->type = $c->type; 27 | $stub->class = $c->class; 28 | $stub->value = $c->value; 29 | $stub->handle = $c->handle; 30 | $stub->cut = $c->cut; 31 | $stub->attr = $c->attr; 32 | 33 | if (Stub::TYPE_REF === $c->type && !$c->class && is_string($c->value) && !preg_match('//u', $c->value)) { 34 | $stub->type = Stub::TYPE_STRING; 35 | $stub->class = Stub::STRING_BINARY; 36 | } 37 | 38 | $a = array(); 39 | } 40 | 41 | return $a; 42 | } 43 | 44 | public static function castCutArray(CutArrayStub $c, array $a, Stub $stub, $isNested) 45 | { 46 | return $isNested ? $c->preservedSubset : $a; 47 | } 48 | 49 | public static function cutInternals($obj, array $a, Stub $stub, $isNested) 50 | { 51 | if ($isNested) { 52 | $stub->cut += count($a); 53 | 54 | return array(); 55 | } 56 | 57 | return $a; 58 | } 59 | 60 | public static function castEnum(EnumStub $c, array $a, Stub $stub, $isNested) 61 | { 62 | if ($isNested) { 63 | $stub->class = $c->dumpKeys ? '' : null; 64 | $stub->handle = 0; 65 | $stub->value = null; 66 | $stub->cut = $c->cut; 67 | $stub->attr = $c->attr; 68 | 69 | $a = array(); 70 | 71 | if ($c->value) { 72 | foreach (array_keys($c->value) as $k) { 73 | $keys[] = !isset($k[0]) || "\0" !== $k[0] ? Caster::PREFIX_VIRTUAL.$k : $k; 74 | } 75 | // Preserve references with array_combine() 76 | $a = array_combine($keys, $c->value); 77 | } 78 | } 79 | 80 | return $a; 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /code/src/Config/training.php: -------------------------------------------------------------------------------- 1 | [ 21 | 'zhengfang' => [ 22 | [ 23 | \CAPTCHAReader\src\App\GetImageInfo\GetImageInfo::class, 24 | \CAPTCHAReader\src\App\Pretreatment\PretreatmentZhengFang::class, 25 | \CAPTCHAReader\src\App\Cutting\CuttingZhengFangFixed::class, 26 | \CAPTCHAReader\src\App\Identify\IdentifyZhengFangColLevenshtein::class, 27 | ], 28 | ], 29 | ], 30 | 31 | /* 32 | |-------------------------------------------------------------------------- 33 | | studySampleGroup 34 | |-------------------------------------------------------------------------- 35 | | 36 | | 学习 样本组 37 | | 38 | */ 39 | 40 | 'studySampleGroup' => [ 41 | 'zhengfang' => __DIR__ . '/../../sample/StudySamples/ZhengFang/', 42 | ], 43 | 44 | /* 45 | |-------------------------------------------------------------------------- 46 | | testSampleGroup 47 | |-------------------------------------------------------------------------- 48 | | 49 | | 测试 样本组 50 | | 51 | */ 52 | 'testSampleGroup' => [ 53 | 'zhengfang' => __DIR__ . '/../../sample/TestSamples/ZhengFang/', 54 | ], 55 | 56 | /* 57 | |-------------------------------------------------------------------------- 58 | | LogPath 59 | |-------------------------------------------------------------------------- 60 | | 日志位置 61 | */ 62 | 63 | 'LogPath' => __DIR__.'/../Log/' , 64 | 65 | /* 66 | |-------------------------------------------------------------------------- 67 | | dictionary Sample Limit by automaticStudy 68 | |-------------------------------------------------------------------------- 69 | | 自动训练的字典数量上限 70 | */ 71 | 72 | 'dictionarySampleLimit' => 4000 , 73 | 74 | /* 75 | |-------------------------------------------------------------------------- 76 | | test Success Rate Line by automaticStudy 77 | |-------------------------------------------------------------------------- 78 | | 自动训练到达触发的测试成功率线 79 | */ 80 | 81 | 'testSuccessRateLine' => 85 , 82 | 83 | ]; -------------------------------------------------------------------------------- /code/src/App/Cutting/CuttingZhengFangFixed.php: -------------------------------------------------------------------------------- 1 | cuttingRepository = $this->getRepository( 'ZhengFangFixed' ); 30 | } 31 | 32 | 33 | function run( ResultContainer $resultContainer ){ 34 | $this->resultContainer = $resultContainer; 35 | $this->conf = $this->resultContainer->getConf(); 36 | $this->imageInfo = $this->resultContainer->getImageInfo(); 37 | $this->noiseCancelArr = $this->resultContainer->getNoiseCancelArr(); 38 | 39 | // $this->showResArr( $this->noiseCancelArr ); 40 | 41 | $width = $this->imageInfo['width']; 42 | $height = $this->imageInfo['height']; 43 | 44 | //获取坐标 45 | $xAllArr = $this->cuttingRepository->getXCoordinate( $width , $height , $this->noiseCancelArr ); 46 | $yAllArr = $this->cuttingRepository->getYCoordinate( $xAllArr , $height , $this->noiseCancelArr ); 47 | 48 | // dump( $xAllArr , $yAllArr ); 49 | 50 | //切割 51 | $pixelCollection = $this->cuttingRepository->cut( $this->noiseCancelArr , compact( 'xAllArr' , 'yAllArr' ) ); 52 | $charPixedCollection = []; 53 | foreach($pixelCollection as $charPixel){ 54 | $charPixedCollection[] = $charPixel['pixel']; 55 | } 56 | //var_dump($charPixedCollection); 57 | // $this->showChar( $charPixedCollection); 58 | 59 | //放入容器 60 | $this->resultContainer->setCoordinate( compact( 'xAllArr' , 'yAllArr' ) ); 61 | $this->resultContainer->setCharPixedCollection( $charPixedCollection ); 62 | //---------------------------------------------------------------------------- 63 | $this->resultContainer = $this->nextStep->run( $this->resultContainer ); 64 | //---------------------------------------------------------------------------- 65 | 66 | return $this->resultContainer; 67 | 68 | } 69 | 70 | 71 | } -------------------------------------------------------------------------------- /code/vendor/symfony/var-dumper/Caster/ArgsStub.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\VarDumper\Caster; 13 | 14 | use Symfony\Component\VarDumper\Cloner\Stub; 15 | 16 | /** 17 | * Represents a list of function arguments. 18 | * 19 | * @author Nicolas Grekas 20 | */ 21 | class ArgsStub extends EnumStub 22 | { 23 | private static $parameters = array(); 24 | 25 | public function __construct(array $args, $function, $class) 26 | { 27 | list($variadic, $params) = self::getParameters($function, $class); 28 | 29 | $values = array(); 30 | foreach ($args as $k => $v) { 31 | $values[$k] = !is_scalar($v) && !$v instanceof Stub ? new CutStub($v) : $v; 32 | } 33 | if (null === $params) { 34 | parent::__construct($values, false); 35 | 36 | return; 37 | } 38 | if (count($values) < count($params)) { 39 | $params = array_slice($params, 0, count($values)); 40 | } elseif (count($values) > count($params)) { 41 | $values[] = new EnumStub(array_splice($values, count($params)), false); 42 | $params[] = $variadic; 43 | } 44 | if (array('...') === $params) { 45 | $this->dumpKeys = false; 46 | $this->value = $values[0]->value; 47 | } else { 48 | $this->value = array_combine($params, $values); 49 | } 50 | } 51 | 52 | private static function getParameters($function, $class) 53 | { 54 | if (isset(self::$parameters[$k = $class.'::'.$function])) { 55 | return self::$parameters[$k]; 56 | } 57 | 58 | try { 59 | $r = null !== $class ? new \ReflectionMethod($class, $function) : new \ReflectionFunction($function); 60 | } catch (\ReflectionException $e) { 61 | return array(null, null); 62 | } 63 | 64 | $variadic = '...'; 65 | $params = array(); 66 | foreach ($r->getParameters() as $v) { 67 | $k = '$'.$v->name; 68 | if ($v->isPassedByReference()) { 69 | $k = '&'.$k; 70 | } 71 | if (method_exists($v, 'isVariadic') && $v->isVariadic()) { 72 | $variadic .= $k; 73 | } else { 74 | $params[] = $k; 75 | } 76 | } 77 | 78 | return self::$parameters[$k] = array($variadic, $params); 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /code/vendor/composer/autoload_real.php: -------------------------------------------------------------------------------- 1 | = 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded()); 27 | if ($useStaticLoader) { 28 | require_once __DIR__ . '/autoload_static.php'; 29 | 30 | call_user_func(\Composer\Autoload\ComposerStaticInit5e7b21114a6d8530f6f5b9dd9c3e2fec::getInitializer($loader)); 31 | } else { 32 | $map = require __DIR__ . '/autoload_namespaces.php'; 33 | foreach ($map as $namespace => $path) { 34 | $loader->set($namespace, $path); 35 | } 36 | 37 | $map = require __DIR__ . '/autoload_psr4.php'; 38 | foreach ($map as $namespace => $path) { 39 | $loader->setPsr4($namespace, $path); 40 | } 41 | 42 | $classMap = require __DIR__ . '/autoload_classmap.php'; 43 | if ($classMap) { 44 | $loader->addClassMap($classMap); 45 | } 46 | } 47 | 48 | $loader->register(true); 49 | 50 | if ($useStaticLoader) { 51 | $includeFiles = Composer\Autoload\ComposerStaticInit5e7b21114a6d8530f6f5b9dd9c3e2fec::$files; 52 | } else { 53 | $includeFiles = require __DIR__ . '/autoload_files.php'; 54 | } 55 | foreach ($includeFiles as $fileIdentifier => $file) { 56 | composerRequire5e7b21114a6d8530f6f5b9dd9c3e2fec($fileIdentifier, $file); 57 | } 58 | 59 | return $loader; 60 | } 61 | } 62 | 63 | function composerRequire5e7b21114a6d8530f6f5b9dd9c3e2fec($fileIdentifier, $file) 64 | { 65 | if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { 66 | require $file; 67 | 68 | $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true; 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /code/vendor/symfony/var-dumper/Caster/XmlResourceCaster.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\VarDumper\Caster; 13 | 14 | use Symfony\Component\VarDumper\Cloner\Stub; 15 | 16 | /** 17 | * Casts XML resources to array representation. 18 | * 19 | * @author Nicolas Grekas 20 | */ 21 | class XmlResourceCaster 22 | { 23 | private static $xmlErrors = array( 24 | XML_ERROR_NONE => 'XML_ERROR_NONE', 25 | XML_ERROR_NO_MEMORY => 'XML_ERROR_NO_MEMORY', 26 | XML_ERROR_SYNTAX => 'XML_ERROR_SYNTAX', 27 | XML_ERROR_NO_ELEMENTS => 'XML_ERROR_NO_ELEMENTS', 28 | XML_ERROR_INVALID_TOKEN => 'XML_ERROR_INVALID_TOKEN', 29 | XML_ERROR_UNCLOSED_TOKEN => 'XML_ERROR_UNCLOSED_TOKEN', 30 | XML_ERROR_PARTIAL_CHAR => 'XML_ERROR_PARTIAL_CHAR', 31 | XML_ERROR_TAG_MISMATCH => 'XML_ERROR_TAG_MISMATCH', 32 | XML_ERROR_DUPLICATE_ATTRIBUTE => 'XML_ERROR_DUPLICATE_ATTRIBUTE', 33 | XML_ERROR_JUNK_AFTER_DOC_ELEMENT => 'XML_ERROR_JUNK_AFTER_DOC_ELEMENT', 34 | XML_ERROR_PARAM_ENTITY_REF => 'XML_ERROR_PARAM_ENTITY_REF', 35 | XML_ERROR_UNDEFINED_ENTITY => 'XML_ERROR_UNDEFINED_ENTITY', 36 | XML_ERROR_RECURSIVE_ENTITY_REF => 'XML_ERROR_RECURSIVE_ENTITY_REF', 37 | XML_ERROR_ASYNC_ENTITY => 'XML_ERROR_ASYNC_ENTITY', 38 | XML_ERROR_BAD_CHAR_REF => 'XML_ERROR_BAD_CHAR_REF', 39 | XML_ERROR_BINARY_ENTITY_REF => 'XML_ERROR_BINARY_ENTITY_REF', 40 | XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF => 'XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF', 41 | XML_ERROR_MISPLACED_XML_PI => 'XML_ERROR_MISPLACED_XML_PI', 42 | XML_ERROR_UNKNOWN_ENCODING => 'XML_ERROR_UNKNOWN_ENCODING', 43 | XML_ERROR_INCORRECT_ENCODING => 'XML_ERROR_INCORRECT_ENCODING', 44 | XML_ERROR_UNCLOSED_CDATA_SECTION => 'XML_ERROR_UNCLOSED_CDATA_SECTION', 45 | XML_ERROR_EXTERNAL_ENTITY_HANDLING => 'XML_ERROR_EXTERNAL_ENTITY_HANDLING', 46 | ); 47 | 48 | public static function castXml($h, array $a, Stub $stub, $isNested) 49 | { 50 | $a['current_byte_index'] = xml_get_current_byte_index($h); 51 | $a['current_column_number'] = xml_get_current_column_number($h); 52 | $a['current_line_number'] = xml_get_current_line_number($h); 53 | $a['error_code'] = xml_get_error_code($h); 54 | 55 | if (isset(self::$xmlErrors[$a['error_code']])) { 56 | $a['error_code'] = new ConstStub(self::$xmlErrors[$a['error_code']], $a['error_code']); 57 | } 58 | 59 | return $a; 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /code/vendor/symfony/var-dumper/Caster/RedisCaster.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\VarDumper\Caster; 13 | 14 | use Symfony\Component\VarDumper\Cloner\Stub; 15 | 16 | /** 17 | * Casts Redis class from ext-redis to array representation. 18 | * 19 | * @author Nicolas Grekas 20 | */ 21 | class RedisCaster 22 | { 23 | private static $serializer = array( 24 | \Redis::SERIALIZER_NONE => 'NONE', 25 | \Redis::SERIALIZER_PHP => 'PHP', 26 | 2 => 'IGBINARY', // Optional Redis::SERIALIZER_IGBINARY 27 | ); 28 | 29 | public static function castRedis(\Redis $c, array $a, Stub $stub, $isNested) 30 | { 31 | $prefix = Caster::PREFIX_VIRTUAL; 32 | 33 | if (defined('HHVM_VERSION_ID')) { 34 | if (isset($a[Caster::PREFIX_PROTECTED.'serializer'])) { 35 | $ser = $a[Caster::PREFIX_PROTECTED.'serializer']; 36 | $a[Caster::PREFIX_PROTECTED.'serializer'] = isset(self::$serializer[$ser]) ? new ConstStub(self::$serializer[$ser], $ser) : $ser; 37 | } 38 | 39 | return $a; 40 | } 41 | 42 | if (!$connected = $c->isConnected()) { 43 | return $a + array( 44 | $prefix.'isConnected' => $connected, 45 | ); 46 | } 47 | 48 | $ser = $c->getOption(\Redis::OPT_SERIALIZER); 49 | $retry = defined('Redis::OPT_SCAN') ? $c->getOption(\Redis::OPT_SCAN) : 0; 50 | 51 | return $a + array( 52 | $prefix.'isConnected' => $connected, 53 | $prefix.'host' => $c->getHost(), 54 | $prefix.'port' => $c->getPort(), 55 | $prefix.'auth' => $c->getAuth(), 56 | $prefix.'dbNum' => $c->getDbNum(), 57 | $prefix.'timeout' => $c->getTimeout(), 58 | $prefix.'persistentId' => $c->getPersistentID(), 59 | $prefix.'options' => new EnumStub(array( 60 | 'READ_TIMEOUT' => $c->getOption(\Redis::OPT_READ_TIMEOUT), 61 | 'SERIALIZER' => isset(self::$serializer[$ser]) ? new ConstStub(self::$serializer[$ser], $ser) : $ser, 62 | 'PREFIX' => $c->getOption(\Redis::OPT_PREFIX), 63 | 'SCAN' => new ConstStub($retry ? 'RETRY' : 'NORETRY', $retry), 64 | )), 65 | ); 66 | } 67 | 68 | public static function castRedisArray(\RedisArray $c, array $a, Stub $stub, $isNested) 69 | { 70 | $prefix = Caster::PREFIX_VIRTUAL; 71 | 72 | return $a + array( 73 | $prefix.'hosts' => $c->_hosts(), 74 | $prefix.'function' => ClassStub::wrapCallable($c->_function()), 75 | ); 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /code/src/App/IndexController.php: -------------------------------------------------------------------------------- 1 | conf = $this->getConfig('app'); 25 | } 26 | 27 | /** 28 | * @param $imagePath 29 | * @param $mode string local|online 30 | * @return string 31 | * 32 | */ 33 | public function entrance($imagePath, $mode, $test = false) 34 | { 35 | try { 36 | //获取 装饰器 37 | $decorator = $this->getDecorator($this->conf); 38 | 39 | //设置 结果容器 40 | $resultContainer = new ResultContainer(); 41 | 42 | $resultContainer->setConf($this->conf); 43 | $resultContainer->setImagePath($imagePath); 44 | $resultContainer->setMode($mode); 45 | $resultContainer = $decorator->run($resultContainer); 46 | $this->image = $resultContainer->imageurl; 47 | if ($test) { 48 | return $resultContainer; 49 | } else { 50 | return $resultContainer->getResultStr(); 51 | } 52 | 53 | } catch (\Exception $exception) { 54 | return $exception->getMessage(); 55 | } 56 | } 57 | 58 | /** 59 | * @param $config 60 | * @return null 61 | */ 62 | public function getDecorator($conf) 63 | { 64 | $useGroup = $conf['useGroup']; 65 | $components = $conf['componentGroup'][$useGroup]; 66 | $decorator = $this->instantiationDecorator($components['components']); 67 | return $decorator; 68 | } 69 | 70 | /** 71 | * @param $components 72 | * @return Restriction 73 | */ 74 | public function instantiationDecorator($components) 75 | { 76 | $components = array_reverse($components); 77 | $decorator = null; 78 | 79 | foreach ($components as $component) { 80 | if (empty($decorator)) { 81 | $decorator = new $component(); 82 | } else { 83 | $decorator = new $component($decorator); 84 | } 85 | } 86 | return $decorator; 87 | } 88 | 89 | /** 90 | * @return mixed|string 91 | */ 92 | public function getConf() 93 | { 94 | return $this->conf; 95 | } 96 | 97 | /** 98 | * @param mixed|string $conf 99 | */ 100 | public function setConf($conf) 101 | { 102 | $this->conf = $conf; 103 | } 104 | } 105 | 106 | 107 | -------------------------------------------------------------------------------- /code/vendor/symfony/var-dumper/Caster/ClassStub.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\VarDumper\Caster; 13 | 14 | /** 15 | * Represents a PHP class identifier. 16 | * 17 | * @author Nicolas Grekas 18 | */ 19 | class ClassStub extends ConstStub 20 | { 21 | /** 22 | * @param string A PHP identifier, e.g. a class, method, interface, etc. name 23 | * @param callable The callable targeted by the identifier when it is ambiguous or not a real PHP identifier 24 | */ 25 | public function __construct($identifier, $callable = null) 26 | { 27 | $this->value = $identifier; 28 | 29 | if (0 < $i = strrpos($identifier, '\\')) { 30 | $this->attr['ellipsis'] = strlen($identifier) - $i; 31 | $this->attr['ellipsis-type'] = 'class'; 32 | $this->attr['ellipsis-tail'] = 1; 33 | } 34 | 35 | try { 36 | if (null !== $callable) { 37 | if ($callable instanceof \Closure) { 38 | $r = new \ReflectionFunction($callable); 39 | } elseif (is_object($callable)) { 40 | $r = array($callable, '__invoke'); 41 | } elseif (is_array($callable)) { 42 | $r = $callable; 43 | } elseif (false !== $i = strpos($callable, '::')) { 44 | $r = array(substr($callable, 0, $i), substr($callable, 2 + $i)); 45 | } else { 46 | $r = new \ReflectionFunction($callable); 47 | } 48 | } elseif (0 < $i = strpos($identifier, '::') ?: strpos($identifier, '->')) { 49 | $r = array(substr($identifier, 0, $i), substr($identifier, 2 + $i)); 50 | } else { 51 | $r = new \ReflectionClass($identifier); 52 | } 53 | 54 | if (is_array($r)) { 55 | try { 56 | $r = new \ReflectionMethod($r[0], $r[1]); 57 | } catch (\ReflectionException $e) { 58 | $r = new \ReflectionClass($r[0]); 59 | } 60 | } 61 | } catch (\ReflectionException $e) { 62 | return; 63 | } 64 | 65 | if ($f = $r->getFileName()) { 66 | $this->attr['file'] = $f; 67 | $this->attr['line'] = $r->getStartLine(); 68 | } 69 | } 70 | 71 | public static function wrapCallable($callable) 72 | { 73 | if (is_object($callable) || !is_callable($callable)) { 74 | return $callable; 75 | } 76 | 77 | if (!is_array($callable)) { 78 | $callable = new static($callable); 79 | } elseif (is_string($callable[0])) { 80 | $callable[0] = new static($callable[0]); 81 | } else { 82 | $callable[1] = new static($callable[1], $callable); 83 | } 84 | 85 | return $callable; 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /code/src/Trait/CuttingTrait.php: -------------------------------------------------------------------------------- 1 | = $beforeX && $x <= $afterX) { 44 | ++$flag; 45 | } 46 | if ($y >= $beforeY && $y <= $afterY) { 47 | ++$flag; 48 | } 49 | 50 | if ($flag == 2) { 51 | return true; 52 | } else { 53 | return false; 54 | } 55 | 56 | } 57 | 58 | /** 59 | * @param $x_ 60 | * @param $y_ 61 | * @param $beforeX 62 | * @param $beforeY 63 | * @return array 64 | */ 65 | public function getPointPositionInArea( $x_ , $y_ , $beforeX , $beforeY ){ 66 | $x = (int)$x_ - (int)$beforeX; 67 | $y = (int)$y_ - (int)$beforeY; 68 | return compact( 'x' , 'y' ); 69 | } 70 | 71 | /** 72 | * @param $charCollection 73 | * 展示切割后的结果和二值化后的数组 74 | */ 75 | public function showCharWeb( $charCollection ){ 76 | echo '
'; 77 | 78 | foreach($charCollection as $key => $char){ 79 | foreach($char as $y => $row){ 80 | foreach($row as $x => $value){ 81 | if ($value) { 82 | echo '◆'; 83 | } else { 84 | echo '◇'; 85 | } 86 | } 87 | echo '
'; 88 | } 89 | } 90 | echo '
'; 91 | } 92 | 93 | /** 94 | * @param $charCollection 95 | */ 96 | public function showChar( $charCollection ){ 97 | foreach($charCollection as $key => $char){ 98 | foreach($char as $y => $row){ 99 | foreach($row as $x => $value){ 100 | if ($value) { 101 | echo 'l '; 102 | } else { 103 | echo '_ '; 104 | } 105 | } 106 | echo "\n"; 107 | } 108 | echo "\n"; 109 | 110 | } 111 | } 112 | 113 | } -------------------------------------------------------------------------------- /code/vendor/symfony/var-dumper/Caster/XmlReaderCaster.php: -------------------------------------------------------------------------------- 1 | 6 | * 7 | * For the full copyright and license information, please view the LICENSE 8 | * file that was distributed with this source code. 9 | */ 10 | 11 | namespace Symfony\Component\VarDumper\Caster; 12 | 13 | use Symfony\Component\VarDumper\Cloner\Stub; 14 | 15 | /** 16 | * Casts XmlReader class to array representation. 17 | * 18 | * @author Baptiste Clavié 19 | */ 20 | class XmlReaderCaster 21 | { 22 | private static $nodeTypes = array( 23 | \XMLReader::NONE => 'NONE', 24 | \XMLReader::ELEMENT => 'ELEMENT', 25 | \XMLReader::ATTRIBUTE => 'ATTRIBUTE', 26 | \XMLReader::TEXT => 'TEXT', 27 | \XMLReader::CDATA => 'CDATA', 28 | \XMLReader::ENTITY_REF => 'ENTITY_REF', 29 | \XMLReader::ENTITY => 'ENTITY', 30 | \XMLReader::PI => 'PI (Processing Instruction)', 31 | \XMLReader::COMMENT => 'COMMENT', 32 | \XMLReader::DOC => 'DOC', 33 | \XMLReader::DOC_TYPE => 'DOC_TYPE', 34 | \XMLReader::DOC_FRAGMENT => 'DOC_FRAGMENT', 35 | \XMLReader::NOTATION => 'NOTATION', 36 | \XMLReader::WHITESPACE => 'WHITESPACE', 37 | \XMLReader::SIGNIFICANT_WHITESPACE => 'SIGNIFICANT_WHITESPACE', 38 | \XMLReader::END_ELEMENT => 'END_ELEMENT', 39 | \XMLReader::END_ENTITY => 'END_ENTITY', 40 | \XMLReader::XML_DECLARATION => 'XML_DECLARATION', 41 | ); 42 | 43 | public static function castXmlReader(\XMLReader $reader, array $a, Stub $stub, $isNested) 44 | { 45 | $props = Caster::PREFIX_VIRTUAL.'parserProperties'; 46 | $info = array( 47 | 'localName' => $reader->localName, 48 | 'prefix' => $reader->prefix, 49 | 'nodeType' => new ConstStub(self::$nodeTypes[$reader->nodeType], $reader->nodeType), 50 | 'depth' => $reader->depth, 51 | 'isDefault' => $reader->isDefault, 52 | 'isEmptyElement' => \XMLReader::NONE === $reader->nodeType ? null : $reader->isEmptyElement, 53 | 'xmlLang' => $reader->xmlLang, 54 | 'attributeCount' => $reader->attributeCount, 55 | 'value' => $reader->value, 56 | 'namespaceURI' => $reader->namespaceURI, 57 | 'baseURI' => $reader->baseURI ? new LinkStub($reader->baseURI) : $reader->baseURI, 58 | $props => array( 59 | 'LOADDTD' => $reader->getParserProperty(\XMLReader::LOADDTD), 60 | 'DEFAULTATTRS' => $reader->getParserProperty(\XMLReader::DEFAULTATTRS), 61 | 'VALIDATE' => $reader->getParserProperty(\XMLReader::VALIDATE), 62 | 'SUBST_ENTITIES' => $reader->getParserProperty(\XMLReader::SUBST_ENTITIES), 63 | ), 64 | ); 65 | 66 | if ($info[$props] = Caster::filter($info[$props], Caster::EXCLUDE_EMPTY, array(), $count)) { 67 | $info[$props] = new EnumStub($info[$props]); 68 | $info[$props]->cut = $count; 69 | } 70 | 71 | $info = Caster::filter($info, Caster::EXCLUDE_EMPTY, array(), $count); 72 | // +2 because hasValue and hasAttributes are always filtered 73 | $stub->cut += $count + 2; 74 | 75 | return $a + $info; 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /code/vendor/composer/autoload_classmap.php: -------------------------------------------------------------------------------- 1 | $baseDir . '/training/AddSamples/AddSamplesAuto.php', 10 | 'CAPTCHAReader\\Training\\AddSamples\\AddSamplesAuto\\Test' => $baseDir . '/training/AddSamples/Test.php', 11 | 'CAPTCHAReader\\Training\\MultiplesTests\\NormalMultiplesTests\\NormalMultipleTests' => $baseDir . '/training/MultipleTests/NormalMultipleTests.php', 12 | 'CAPTCHAReader\\Training\\MultiplesTests\\NormalMultiplesTests\\NormalMultipleTests\\Test' => $baseDir . '/training/MultipleTests/Test.php', 13 | 'CAPTCHAReader\\src\\App\\Abstracts\\Load' => $baseDir . '/src/Abstracts/Load.php', 14 | 'CAPTCHAReader\\src\\App\\Abstracts\\Restriction' => $baseDir . '/src/Abstracts/Restriction.php', 15 | 'CAPTCHAReader\\src\\App\\Cutting\\CuttingZhengFangFixed' => $baseDir . '/src/App/Cutting/CuttingZhengFangFixed.php', 16 | 'CAPTCHAReader\\src\\App\\Cutting\\CuttingZhengFangMove' => $baseDir . '/src/App/Cutting/CuttingZhengFangMove.php', 17 | 'CAPTCHAReader\\src\\App\\GetImageInfo\\GetImageInfo' => $baseDir . '/src/App/GetImageInfo/GetImageInfo.php', 18 | 'CAPTCHAReader\\src\\App\\Identify\\IdentifyZhengFangCol' => $baseDir . '/src/App/Identify/IdentifyZhengFangCol.php', 19 | 'CAPTCHAReader\\src\\App\\Identify\\IdentifyZhengFangColLevenshtein' => $baseDir . '/src/App/Identify/IdentifyZhengFangColLevenshtein.php', 20 | 'CAPTCHAReader\\src\\App\\IndexController' => $baseDir . '/src/App/IndexController.php', 21 | 'CAPTCHAReader\\src\\App\\Pretreatment\\PretreatmentZhengFang' => $baseDir . '/src/App/Pretreatment/PretreatmentZhengFang.php', 22 | 'CAPTCHAReader\\src\\App\\ResultContainer' => $baseDir . '/src/App/ResultContainer.php', 23 | 'CAPTCHAReader\\src\\Log\\Log' => $baseDir . '/src/Log/Log.php', 24 | 'CAPTCHAReader\\src\\Repository\\Cutting\\CuttingZhengFangFixedRepository' => $baseDir . '/src/Repositories/Cutting/CuttingZhengFangFixedRepository.php', 25 | 'CAPTCHAReader\\src\\Repository\\Cutting\\CuttingZhengFangMoveRepository' => $baseDir . '/src/Repositories/Cutting/CuttingZhengFangMoveRepository.php', 26 | 'CAPTCHAReader\\src\\Repository\\Identify\\IdentifyZhengFangColLevenshteinRepository' => $baseDir . '/src/Repositories/Identify/IdentifyZhengFangColLevenshteinRepository.php', 27 | 'CAPTCHAReader\\src\\Repository\\Identify\\IdentifyZhengFangColRepository' => $baseDir . '/src/Repositories/Identify/IdentifyZhengFangColRepository.php', 28 | 'CAPTCHAReader\\src\\Repository\\Pretreatment\\PretreatmentQinGuoRepository' => $baseDir . '/src/Repositories/Pretreatment/PretreatmentQinGuoRepository.php', 29 | 'CAPTCHAReader\\src\\Repository\\Pretreatment\\PretreatmentZhengFangRepository' => $baseDir . '/src/Repositories/Pretreatment/PretreatmentZhengFangRepository.php', 30 | 'CAPTCHAReader\\src\\Traits\\CommonTrait' => $baseDir . '/src/Trait/CommonTrait.php', 31 | 'CAPTCHAReader\\src\\Traits\\CuttingTrait' => $baseDir . '/src/Trait/CuttingTrait.php', 32 | 'CAPTCHAReader\\src\\Traits\\GetImageInfoTrait' => $baseDir . '/src/Trait/GetImageInfoTrait.php', 33 | 'CAPTCHAReader\\src\\Traits\\IdentifyTrait' => $baseDir . '/src/Trait/IdentifyTrait.php', 34 | 'CAPTCHAReader\\src\\Traits\\PretreatmentTrait' => $baseDir . '/src/Trait/PretreatmentTrait.php', 35 | 'CAPTCHAReader\\training\\Abstracts\\TestsInterface' => $baseDir . '/training/Abstracts/TestsInterface.php', 36 | 'CAPTCHAReader\\training\\Traits\\CommonTrait' => $baseDir . '/training/Trait/CommonTrait.php', 37 | ); 38 | -------------------------------------------------------------------------------- /code/src/Repositories/Pretreatment/PretreatmentZhengFangRepository.php: -------------------------------------------------------------------------------- 1 | 100) { 28 | $imageArr[$y][$x] = '1'; 29 | } else { 30 | $imageArr[$y][$x] = '0'; 31 | } 32 | } 33 | } 34 | return $imageArr; 35 | } 36 | 37 | /** 38 | * @param $width 39 | * @param $height 40 | * @param $array 41 | * @return mixed 42 | * 简单的降噪方法 43 | */ 44 | public function SimpleNoiseCancel( $width , $height , $array ) 45 | { 46 | for($y = 0; $y < $height; ++$y) 47 | { 48 | for($x = 0; $x < $width; ++$x) 49 | { 50 | if ($array[$y][$x] == 1) 51 | { 52 | $num = 0; 53 | // 上 54 | if (isset( $array[$y - 1][$x] )) 55 | { 56 | $num = $num + $array[$y - 1][$x]; 57 | } 58 | // 下 59 | if (isset( $array[$y + 1][$x] )) 60 | { 61 | $num = $num + $array[$y + 1][$x]; 62 | } 63 | // 左 64 | if (isset( $array[$y][$x - 1] )) 65 | { 66 | $num = $num + $array[$y][$x - 1]; 67 | } 68 | // 右 69 | if (isset( $array[$y][$x + 1] )) 70 | { 71 | $num = $num + $array[$y][$x + 1]; 72 | } 73 | // 上左 74 | if (isset( $array[$y - 1][$x - 1] )) 75 | { 76 | $num = $num + $array[$y - 1][$x - 1]; 77 | } 78 | // 上右 79 | if (isset( $array[$y - 1][$x + 1] )) 80 | { 81 | $num = $num + $array[$y - 1][$x + 1]; 82 | } 83 | // 下左 84 | if (isset( $array[$y + 1][$x - 1] )) 85 | { 86 | $num = $num + $array[$y + 1][$x - 1]; 87 | } 88 | // 下右 89 | if (isset( $array[$y + 1][$x + 1] )) 90 | { 91 | $num = $num + $array[$y + 1][$x + 1]; 92 | } 93 | if ($num < 3) 94 | {//如果周围的像素数量小于3(也就是为1,或2)则判定为噪点,去除 95 | $array[$y][$x] = '0'; 96 | } 97 | else 98 | { 99 | $array[$y][$x] = '1'; 100 | } 101 | } 102 | } 103 | } 104 | return $array; 105 | 106 | } 107 | 108 | 109 | } -------------------------------------------------------------------------------- /code/training/MultipleTests/NormalMultipleTests.php: -------------------------------------------------------------------------------- 1 | getTestSampleList($groupName, $area); 33 | $resultArr = []; 34 | 35 | foreach ($sampleListArr as $testSetNumber => $sampleList) { 36 | $sampleNumber = count($sampleList); 37 | $time = time(); 38 | 39 | $resultDistributed = [ 40 | 'count' => $sampleNumber, 41 | 'true' => 0, 42 | 'false' => 0, 43 | 'charTrue' => 0, 44 | 'charFalse' => 0, 45 | ]; 46 | 47 | foreach ($sampleList as $key => $sampleFilePath) { 48 | //样本答案数组 49 | preg_match('/\w+(?=.?\w+$)/', $sampleFilePath, $matches); 50 | $trueAnswer = $matches[0]; 51 | 52 | //识别的结果数组 53 | $answer = $indexController->entrance($sampleFilePath, 'local'); 54 | //进行判断,得到判断结果数组 55 | $judgmentResult = $this->judgment($trueAnswer, $answer); 56 | 57 | if ($judgmentResult['result']) { 58 | ++$resultDistributed['true']; 59 | } else { 60 | ++$resultDistributed['false']; 61 | } 62 | 63 | $resultDistributed['charTrue'] += $judgmentResult['charResult']['true']; 64 | $resultDistributed['charFalse'] += $judgmentResult['charResult']['false']; 65 | 66 | $testLog[$key] = $judgmentResult; 67 | } 68 | dump($resultDistributed); 69 | 70 | //记录日志 71 | //这里记录的是测试日志 72 | $testLog['resultDistributed'] = $resultDistributed; 73 | Log::writeMultipleTestsLog($groupName, $testLog, $trainingId, $testSetNumber); 74 | 75 | $resultArr = [ 76 | 'correctRate' => 77 | ($resultDistributed['true'] / $resultDistributed['count']) * 100, 78 | 'charCorrectRate' => 79 | ($resultDistributed['charTrue'] / ($resultDistributed['count'] * 4 )* 100), 80 | ]; 81 | } 82 | 83 | return $resultArr; 84 | } 85 | 86 | 87 | /** 88 | * @param $sampleArr 89 | * @param $result 90 | * @return array 91 | */ 92 | public function judgment($trueAnswer, $answer) 93 | { 94 | $target = [$trueAnswer, $answer]; 95 | $charResult = ['true' => 0, 'false' => 0,]; 96 | 97 | $flag = 0; 98 | for ($i = 0; $i < strlen($trueAnswer); ++$i) { 99 | if ($trueAnswer[$i] != $answer[$i]) { 100 | $flag = 1; 101 | ++$charResult['false']; 102 | } else { 103 | ++$charResult['true']; 104 | } 105 | } 106 | 107 | !$flag ? $result = true : $result = false; 108 | 109 | return compact('target', 'result', 'charResult'); 110 | } 111 | 112 | 113 | } -------------------------------------------------------------------------------- /code/vendor/symfony/var-dumper/Caster/LinkStub.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\VarDumper\Caster; 13 | 14 | /** 15 | * Represents a file or a URL. 16 | * 17 | * @author Nicolas Grekas 18 | */ 19 | class LinkStub extends ConstStub 20 | { 21 | public $inVendor = false; 22 | 23 | private static $vendorRoots; 24 | private static $composerRoots; 25 | 26 | public function __construct($label, $line = 0, $href = null) 27 | { 28 | $this->value = $label; 29 | 30 | if (null === $href) { 31 | $href = $label; 32 | } 33 | if (!is_string($href)) { 34 | return; 35 | } 36 | if (0 === strpos($href, 'file://')) { 37 | if ($href === $label) { 38 | $label = substr($label, 7); 39 | } 40 | $href = substr($href, 7); 41 | } elseif (false !== strpos($href, '://')) { 42 | $this->attr['href'] = $href; 43 | 44 | return; 45 | } 46 | if (!file_exists($href)) { 47 | return; 48 | } 49 | if ($line) { 50 | $this->attr['line'] = $line; 51 | } 52 | if ($label !== $this->attr['file'] = realpath($href) ?: $href) { 53 | return; 54 | } 55 | if ($composerRoot = $this->getComposerRoot($href, $this->inVendor)) { 56 | $this->attr['ellipsis'] = strlen($href) - strlen($composerRoot) + 1; 57 | $this->attr['ellipsis-type'] = 'path'; 58 | $this->attr['ellipsis-tail'] = 1 + ($this->inVendor ? 2 + strlen(implode(array_slice(explode(DIRECTORY_SEPARATOR, substr($href, 1 - $this->attr['ellipsis'])), 0, 2))) : 0); 59 | } elseif (3 < count($ellipsis = explode(DIRECTORY_SEPARATOR, $href))) { 60 | $this->attr['ellipsis'] = 2 + strlen(implode(array_slice($ellipsis, -2))); 61 | $this->attr['ellipsis-type'] = 'path'; 62 | $this->attr['ellipsis-tail'] = 1; 63 | } 64 | } 65 | 66 | private function getComposerRoot($file, &$inVendor) 67 | { 68 | if (null === self::$vendorRoots) { 69 | self::$vendorRoots = array(); 70 | 71 | foreach (get_declared_classes() as $class) { 72 | if ('C' === $class[0] && 0 === strpos($class, 'ComposerAutoloaderInit')) { 73 | $r = new \ReflectionClass($class); 74 | $v = dirname(dirname($r->getFileName())); 75 | if (file_exists($v.'/composer/installed.json')) { 76 | self::$vendorRoots[] = $v.DIRECTORY_SEPARATOR; 77 | } 78 | } 79 | } 80 | } 81 | $inVendor = false; 82 | 83 | if (isset(self::$composerRoots[$dir = dirname($file)])) { 84 | return self::$composerRoots[$dir]; 85 | } 86 | 87 | foreach (self::$vendorRoots as $root) { 88 | if ($inVendor = 0 === strpos($file, $root)) { 89 | return $root; 90 | } 91 | } 92 | 93 | $parent = $dir; 94 | while (!@file_exists($parent.'/composer.json')) { 95 | if (!@file_exists($parent)) { 96 | // open_basedir restriction in effect 97 | break; 98 | } 99 | if ($parent === dirname($parent)) { 100 | return self::$composerRoots[$dir] = false; 101 | } 102 | 103 | $parent = dirname($parent); 104 | } 105 | 106 | return self::$composerRoots[$dir] = $parent.DIRECTORY_SEPARATOR; 107 | } 108 | } 109 | -------------------------------------------------------------------------------- /code/src/App/captcha.php: -------------------------------------------------------------------------------- 1 | entrance($_POST['codeurl'],'online'); 23 | $a->image = str_replace('src\Config/../../','', $a->image); 24 | $a->image = substr($a->image,'24',strlen($a->image)-11); 25 | dump($c); 26 | echo ""; 27 | $end_time = microtime(true);//计时停止 28 | echo '执行时间为:' . ($end_time - $start_time) . ' s' . '
'; 29 | }else{ 30 | 31 | } 32 | 33 | 34 | /** 35 | * curl_request() 函数用来进行远程 http 请求 36 | * @param array $aArg 设置请求的参数,可最多包含下面 (array)$default 中所有的键值对 37 | * @return string 返回请求结果,结果是字符串 38 | */ 39 | function curl_request($aArg=array()){ 40 | /* 定义默认的参数 */ 41 | $default = array( 42 | 'url'=>'', //远程请求的页面, 等同于 html 表单中的 action; 43 | 'method'=>'get', //数据传输方式: post 和 get(默认); 44 | 'data'=>'', //HTTP请求中的数据, 支持数组和 name=value 方式的 url 查询字符串, 要发送文件,在文件名前面加上@前缀并使用完整路径。; 45 | 'cookie'=>'', //HTTP请求中"Cookie: "部分的内容。多个cookie用分号分隔,分号后带一个空格(例如, "fruit=apple; colour=red"); 46 | 'referer'=>'', //HTTP请求头中"Referer: "的内容 47 | 'userAgent'=>'', //HTTP请求中包含一个"User-Agent: "头的字符串 48 | 'requestHeaders'=>array(), //用来设置 HTTP 请求头部字段的数组,形式: array('Content-type: text/plain', 'Content-length: 100') 49 | 'sessionCookie'=>false, //传输 cookie 时仅传输 Session Cookie 50 | 'autoReferer'=>true, //当根据 Location: 重定向时自动填写头部 Referer: 信息 51 | 'responseHeaders'=>false, //也将响应头部返回在文件流中 52 | 'sslVerify'=>false, //SSL 安全证书验证 53 | 'timeout'=>30, //设置超时; 54 | 'username'=>'', //http 登录方式的用户名; 55 | 'password'=>'' //http 登录方式的密码; 56 | ); 57 | $aArg = array_merge($default, $aArg); 58 | $ch = curl_init(); 59 | curl_setopt($ch, CURLOPT_URL, $aArg['url']); 60 | curl_setopt($ch, CURLOPT_COOKIESESSION, $aArg['sessionCookie']); 61 | curl_setopt($ch, CURLOPT_AUTOREFERER, $aArg['autoReferer']); 62 | curl_setopt($ch, CURLOPT_HEADER, $aArg['responseHeaders']); 63 | curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/4"); 64 | curl_setopt($ch,CURLOPT_FOLLOWLOCATION,true); 65 | curl_setopt($ch, CURLOPT_TIMEOUT, $aArg['timeout']); 66 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 67 | if(strtolower($aArg['method']) == 'post') { 68 | curl_setopt($ch, CURLOPT_POST, 1); 69 | curl_setopt($ch, CURLOPT_POSTFIELDS, $aArg['data']); 70 | }else{ 71 | if($aArg['data'] && (is_string($aArg['data']) || is_array($aArg['data']))) { 72 | $aArg['url'] .= (preg_match('/\?/', $aArg['url']) ? '&' : '?') . (is_string($aArg['data']) ? $aArg['data'] : http_build_query($aArg['data'])); 73 | } 74 | } 75 | if($aArg['sslVerify']){ 76 | curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 2); 77 | }else{ 78 | curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); 79 | } 80 | @curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, true); 81 | if($aArg['cookie']) curl_setopt($ch, CURLOPT_COOKIE, $aArg['cookie']); 82 | if($aArg['referer']) curl_setopt($ch, CURLOPT_REFERER, $aArg['referer']); 83 | if($aArg['userAgent']) curl_setopt($ch, CURLOPT_USERAGENT, $aArg['userAgent']); 84 | if(!empty($aArg['requestHeaders'])) curl_setopt($ch, CURLOPT_HTTPHEADER, $aArg['requestHeaders']); 85 | if($aArg['username'] && $aArg['password']) curl_setopt($ch, CURLOPT_USERPWD, '['.$aArg['username'].']:['.$aArg['password'].']'); 86 | $data = curl_exec($ch); 87 | if (curl_errno($ch)) return curl_error($ch); 88 | curl_close($ch); 89 | return $data; 90 | } 91 | 92 | ?> 93 | 94 | 95 |
96 | 97 |
98 | 请填写正方教务系统验证码的地址(类似“http://210.36.247.23/CheckCode.aspx”),提交即可查询验证码。目前系统只有正方教务系统的训练库, 整体识别正确率 87%,单个字母识别正确率率到 96.5%,每次提交只能测试一次。 99 |
-------------------------------------------------------------------------------- /code/vendor/symfony/var-dumper/Tests/Cloner/DataTest.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\VarDumper\Tests\Cloner; 13 | 14 | use PHPUnit\Framework\TestCase; 15 | use Symfony\Component\VarDumper\Caster\Caster; 16 | use Symfony\Component\VarDumper\Caster\ClassStub; 17 | use Symfony\Component\VarDumper\Cloner\Data; 18 | use Symfony\Component\VarDumper\Cloner\VarCloner; 19 | 20 | class DataTest extends TestCase 21 | { 22 | public function testBasicData() 23 | { 24 | $values = array(1 => 123, 4.5, 'abc', null, false); 25 | $data = $this->cloneVar($values); 26 | $clonedValues = array(); 27 | 28 | $this->assertInstanceOf(Data::class, $data); 29 | $this->assertCount(count($values), $data); 30 | $this->assertFalse(isset($data->{0})); 31 | $this->assertFalse(isset($data[0])); 32 | 33 | foreach ($data as $k => $v) { 34 | $this->assertTrue(isset($data->{$k})); 35 | $this->assertTrue(isset($data[$k])); 36 | $this->assertSame(gettype($values[$k]), $data->seek($k)->getType()); 37 | $this->assertSame($values[$k], $data->seek($k)->getValue()); 38 | $this->assertSame($values[$k], $data->{$k}); 39 | $this->assertSame($values[$k], $data[$k]); 40 | $this->assertSame((string) $values[$k], (string) $data->seek($k)); 41 | 42 | $clonedValues[$k] = $v->getValue(); 43 | } 44 | 45 | $this->assertSame($values, $clonedValues); 46 | } 47 | 48 | public function testObject() 49 | { 50 | $data = $this->cloneVar(new \Exception('foo')); 51 | 52 | $this->assertSame('Exception', $data->getType()); 53 | 54 | $this->assertSame('foo', $data->message); 55 | $this->assertSame('foo', $data->{Caster::PREFIX_PROTECTED.'message'}); 56 | 57 | $this->assertSame('foo', $data['message']); 58 | $this->assertSame('foo', $data[Caster::PREFIX_PROTECTED.'message']); 59 | 60 | $this->assertStringMatchesFormat('Exception (count=%d)', (string) $data); 61 | } 62 | 63 | public function testArray() 64 | { 65 | $values = array(array(), array(123)); 66 | $data = $this->cloneVar($values); 67 | 68 | $this->assertSame($values, $data->getValue(true)); 69 | 70 | $children = $data->getValue(); 71 | 72 | $this->assertInternalType('array', $children); 73 | 74 | $this->assertInstanceOf(Data::class, $children[0]); 75 | $this->assertInstanceOf(Data::class, $children[1]); 76 | 77 | $this->assertEquals($children[0], $data[0]); 78 | $this->assertEquals($children[1], $data[1]); 79 | 80 | $this->assertSame($values[0], $children[0]->getValue(true)); 81 | $this->assertSame($values[1], $children[1]->getValue(true)); 82 | } 83 | 84 | public function testStub() 85 | { 86 | $data = $this->cloneVar(array(new ClassStub('stdClass'))); 87 | $data = $data[0]; 88 | 89 | $this->assertSame('string', $data->getType()); 90 | $this->assertSame('stdClass', $data->getValue()); 91 | $this->assertSame('stdClass', (string) $data); 92 | } 93 | 94 | public function testHardRefs() 95 | { 96 | $values = array(array()); 97 | $values[1] = &$values[0]; 98 | $values[2][0] = &$values[2]; 99 | 100 | $data = $this->cloneVar($values); 101 | 102 | $this->assertSame(array(), $data[0]->getValue()); 103 | $this->assertSame(array(), $data[1]->getValue()); 104 | $this->assertEquals(array($data[2]->getValue()), $data[2]->getValue(true)); 105 | 106 | $this->assertSame('array (count=3)', (string) $data); 107 | } 108 | 109 | private function cloneVar($value) 110 | { 111 | $cloner = new VarCloner(); 112 | 113 | return $cloner->cloneVar($value); 114 | } 115 | } 116 | -------------------------------------------------------------------------------- /code/vendor/symfony/var-dumper/Caster/PdoCaster.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\VarDumper\Caster; 13 | 14 | use Symfony\Component\VarDumper\Cloner\Stub; 15 | 16 | /** 17 | * Casts PDO related classes to array representation. 18 | * 19 | * @author Nicolas Grekas 20 | */ 21 | class PdoCaster 22 | { 23 | private static $pdoAttributes = array( 24 | 'CASE' => array( 25 | \PDO::CASE_LOWER => 'LOWER', 26 | \PDO::CASE_NATURAL => 'NATURAL', 27 | \PDO::CASE_UPPER => 'UPPER', 28 | ), 29 | 'ERRMODE' => array( 30 | \PDO::ERRMODE_SILENT => 'SILENT', 31 | \PDO::ERRMODE_WARNING => 'WARNING', 32 | \PDO::ERRMODE_EXCEPTION => 'EXCEPTION', 33 | ), 34 | 'TIMEOUT', 35 | 'PREFETCH', 36 | 'AUTOCOMMIT', 37 | 'PERSISTENT', 38 | 'DRIVER_NAME', 39 | 'SERVER_INFO', 40 | 'ORACLE_NULLS' => array( 41 | \PDO::NULL_NATURAL => 'NATURAL', 42 | \PDO::NULL_EMPTY_STRING => 'EMPTY_STRING', 43 | \PDO::NULL_TO_STRING => 'TO_STRING', 44 | ), 45 | 'CLIENT_VERSION', 46 | 'SERVER_VERSION', 47 | 'STATEMENT_CLASS', 48 | 'EMULATE_PREPARES', 49 | 'CONNECTION_STATUS', 50 | 'STRINGIFY_FETCHES', 51 | 'DEFAULT_FETCH_MODE' => array( 52 | \PDO::FETCH_ASSOC => 'ASSOC', 53 | \PDO::FETCH_BOTH => 'BOTH', 54 | \PDO::FETCH_LAZY => 'LAZY', 55 | \PDO::FETCH_NUM => 'NUM', 56 | \PDO::FETCH_OBJ => 'OBJ', 57 | ), 58 | ); 59 | 60 | public static function castPdo(\PDO $c, array $a, Stub $stub, $isNested) 61 | { 62 | $attr = array(); 63 | $errmode = $c->getAttribute(\PDO::ATTR_ERRMODE); 64 | $c->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION); 65 | 66 | foreach (self::$pdoAttributes as $k => $v) { 67 | if (!isset($k[0])) { 68 | $k = $v; 69 | $v = array(); 70 | } 71 | 72 | try { 73 | $attr[$k] = 'ERRMODE' === $k ? $errmode : $c->getAttribute(constant('PDO::ATTR_'.$k)); 74 | if ($v && isset($v[$attr[$k]])) { 75 | $attr[$k] = new ConstStub($v[$attr[$k]], $attr[$k]); 76 | } 77 | } catch (\Exception $e) { 78 | } 79 | } 80 | if (isset($attr[$k = 'STATEMENT_CLASS'][1])) { 81 | if ($attr[$k][1]) { 82 | $attr[$k][1] = new ArgsStub($attr[$k][1], '__construct', $attr[$k][0]); 83 | } 84 | $attr[$k][0] = new ClassStub($attr[$k][0]); 85 | } 86 | 87 | $prefix = Caster::PREFIX_VIRTUAL; 88 | $a += array( 89 | $prefix.'inTransaction' => method_exists($c, 'inTransaction'), 90 | $prefix.'errorInfo' => $c->errorInfo(), 91 | $prefix.'attributes' => new EnumStub($attr), 92 | ); 93 | 94 | if ($a[$prefix.'inTransaction']) { 95 | $a[$prefix.'inTransaction'] = $c->inTransaction(); 96 | } else { 97 | unset($a[$prefix.'inTransaction']); 98 | } 99 | 100 | if (!isset($a[$prefix.'errorInfo'][1], $a[$prefix.'errorInfo'][2])) { 101 | unset($a[$prefix.'errorInfo']); 102 | } 103 | 104 | $c->setAttribute(\PDO::ATTR_ERRMODE, $errmode); 105 | 106 | return $a; 107 | } 108 | 109 | public static function castPdoStatement(\PDOStatement $c, array $a, Stub $stub, $isNested) 110 | { 111 | $prefix = Caster::PREFIX_VIRTUAL; 112 | $a[$prefix.'errorInfo'] = $c->errorInfo(); 113 | 114 | if (!isset($a[$prefix.'errorInfo'][1], $a[$prefix.'errorInfo'][2])) { 115 | unset($a[$prefix.'errorInfo']); 116 | } 117 | 118 | return $a; 119 | } 120 | } 121 | -------------------------------------------------------------------------------- /code/vendor/composer/installed.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "name": "symfony/polyfill-mbstring", 4 | "version": "v1.8.0", 5 | "version_normalized": "1.8.0.0", 6 | "source": { 7 | "type": "git", 8 | "url": "https://github.com/symfony/polyfill-mbstring.git", 9 | "reference": "3296adf6a6454a050679cde90f95350ad604b171" 10 | }, 11 | "dist": { 12 | "type": "zip", 13 | "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/3296adf6a6454a050679cde90f95350ad604b171", 14 | "reference": "3296adf6a6454a050679cde90f95350ad604b171", 15 | "shasum": "" 16 | }, 17 | "require": { 18 | "php": ">=5.3.3" 19 | }, 20 | "suggest": { 21 | "ext-mbstring": "For best performance" 22 | }, 23 | "time": "2018-04-26T10:06:28+00:00", 24 | "type": "library", 25 | "extra": { 26 | "branch-alias": { 27 | "dev-master": "1.8-dev" 28 | } 29 | }, 30 | "installation-source": "dist", 31 | "autoload": { 32 | "psr-4": { 33 | "Symfony\\Polyfill\\Mbstring\\": "" 34 | }, 35 | "files": [ 36 | "bootstrap.php" 37 | ] 38 | }, 39 | "notification-url": "https://packagist.org/downloads/", 40 | "license": [ 41 | "MIT" 42 | ], 43 | "authors": [ 44 | { 45 | "name": "Nicolas Grekas", 46 | "email": "p@tchwork.com" 47 | }, 48 | { 49 | "name": "Symfony Community", 50 | "homepage": "https://symfony.com/contributors" 51 | } 52 | ], 53 | "description": "Symfony polyfill for the Mbstring extension", 54 | "homepage": "https://symfony.com", 55 | "keywords": [ 56 | "compatibility", 57 | "mbstring", 58 | "polyfill", 59 | "portable", 60 | "shim" 61 | ] 62 | }, 63 | { 64 | "name": "symfony/var-dumper", 65 | "version": "v3.4.9", 66 | "version_normalized": "3.4.9.0", 67 | "source": { 68 | "type": "git", 69 | "url": "https://github.com/symfony/var-dumper.git", 70 | "reference": "0e6545672d8c9ce70dd472adc2f8b03155a46f73" 71 | }, 72 | "dist": { 73 | "type": "zip", 74 | "url": "https://api.github.com/repos/symfony/var-dumper/zipball/0e6545672d8c9ce70dd472adc2f8b03155a46f73", 75 | "reference": "0e6545672d8c9ce70dd472adc2f8b03155a46f73", 76 | "shasum": "" 77 | }, 78 | "require": { 79 | "php": "^5.5.9|>=7.0.8", 80 | "symfony/polyfill-mbstring": "~1.0" 81 | }, 82 | "conflict": { 83 | "phpunit/phpunit": "<4.8.35|<5.4.3,>=5.0" 84 | }, 85 | "require-dev": { 86 | "ext-iconv": "*", 87 | "twig/twig": "~1.34|~2.4" 88 | }, 89 | "suggest": { 90 | "ext-iconv": "To convert non-UTF-8 strings to UTF-8 (or symfony/polyfill-iconv in case ext-iconv cannot be used).", 91 | "ext-intl": "To show region name in time zone dump", 92 | "ext-symfony_debug": "" 93 | }, 94 | "time": "2018-04-26T12:42:15+00:00", 95 | "type": "library", 96 | "extra": { 97 | "branch-alias": { 98 | "dev-master": "3.4-dev" 99 | } 100 | }, 101 | "installation-source": "dist", 102 | "autoload": { 103 | "files": [ 104 | "Resources/functions/dump.php" 105 | ], 106 | "psr-4": { 107 | "Symfony\\Component\\VarDumper\\": "" 108 | }, 109 | "exclude-from-classmap": [ 110 | "/Tests/" 111 | ] 112 | }, 113 | "notification-url": "https://packagist.org/downloads/", 114 | "license": [ 115 | "MIT" 116 | ], 117 | "authors": [ 118 | { 119 | "name": "Nicolas Grekas", 120 | "email": "p@tchwork.com" 121 | }, 122 | { 123 | "name": "Symfony Community", 124 | "homepage": "https://symfony.com/contributors" 125 | } 126 | ], 127 | "description": "Symfony mechanism for exploring and dumping PHP variables", 128 | "homepage": "https://symfony.com", 129 | "keywords": [ 130 | "debug", 131 | "dump" 132 | ] 133 | } 134 | ] 135 | -------------------------------------------------------------------------------- /code/vendor/symfony/var-dumper/Tests/Caster/SplCasterTest.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\VarDumper\Tests\Caster; 13 | 14 | use PHPUnit\Framework\TestCase; 15 | use Symfony\Component\VarDumper\Test\VarDumperTestTrait; 16 | 17 | /** 18 | * @author Grégoire Pineau 19 | */ 20 | class SplCasterTest extends TestCase 21 | { 22 | use VarDumperTestTrait; 23 | 24 | public function getCastFileInfoTests() 25 | { 26 | return array( 27 | array(__FILE__, <<<'EOTXT' 28 | SplFileInfo { 29 | %Apath: "%sCaster" 30 | filename: "SplCasterTest.php" 31 | basename: "SplCasterTest.php" 32 | pathname: "%sSplCasterTest.php" 33 | extension: "php" 34 | realPath: "%sSplCasterTest.php" 35 | aTime: %s-%s-%d %d:%d:%d 36 | mTime: %s-%s-%d %d:%d:%d 37 | cTime: %s-%s-%d %d:%d:%d 38 | inode: %d 39 | size: %d 40 | perms: 0%d 41 | owner: %d 42 | group: %d 43 | type: "file" 44 | writable: true 45 | readable: true 46 | executable: false 47 | file: true 48 | dir: false 49 | link: false 50 | %A} 51 | EOTXT 52 | ), 53 | array('https://google.com/about', <<<'EOTXT' 54 | SplFileInfo { 55 | %Apath: "https://google.com" 56 | filename: "about" 57 | basename: "about" 58 | pathname: "https://google.com/about" 59 | extension: "" 60 | realPath: false 61 | %A} 62 | EOTXT 63 | ), 64 | ); 65 | } 66 | 67 | /** @dataProvider getCastFileInfoTests */ 68 | public function testCastFileInfo($file, $dump) 69 | { 70 | $this->assertDumpMatchesFormat($dump, new \SplFileInfo($file)); 71 | } 72 | 73 | public function testCastFileObject() 74 | { 75 | $var = new \SplFileObject(__FILE__); 76 | $var->setFlags(\SplFileObject::DROP_NEW_LINE | \SplFileObject::SKIP_EMPTY); 77 | $dump = <<<'EOTXT' 78 | SplFileObject { 79 | %Apath: "%sCaster" 80 | filename: "SplCasterTest.php" 81 | basename: "SplCasterTest.php" 82 | pathname: "%sSplCasterTest.php" 83 | extension: "php" 84 | realPath: "%sSplCasterTest.php" 85 | aTime: %s-%s-%d %d:%d:%d 86 | mTime: %s-%s-%d %d:%d:%d 87 | cTime: %s-%s-%d %d:%d:%d 88 | inode: %d 89 | size: %d 90 | perms: 0%d 91 | owner: %d 92 | group: %d 93 | type: "file" 94 | writable: true 95 | readable: true 96 | executable: false 97 | file: true 98 | dir: false 99 | link: false 100 | %AcsvControl: array:%d [ 101 | 0 => "," 102 | 1 => """ 103 | %A] 104 | flags: DROP_NEW_LINE|SKIP_EMPTY 105 | maxLineLen: 0 106 | fstat: array:26 [ 107 | "dev" => %d 108 | "ino" => %d 109 | "nlink" => %d 110 | "rdev" => 0 111 | "blksize" => %i 112 | "blocks" => %i 113 | …20 114 | ] 115 | eof: false 116 | key: 0 117 | } 118 | EOTXT; 119 | $this->assertDumpMatchesFormat($dump, $var); 120 | } 121 | 122 | /** 123 | * @dataProvider provideCastSplDoublyLinkedList 124 | */ 125 | public function testCastSplDoublyLinkedList($modeValue, $modeDump) 126 | { 127 | $var = new \SplDoublyLinkedList(); 128 | $var->setIteratorMode($modeValue); 129 | $dump = <<assertDumpMatchesFormat($dump, $var); 136 | } 137 | 138 | public function provideCastSplDoublyLinkedList() 139 | { 140 | return array( 141 | array(\SplDoublyLinkedList::IT_MODE_FIFO, 'IT_MODE_FIFO | IT_MODE_KEEP'), 142 | array(\SplDoublyLinkedList::IT_MODE_LIFO, 'IT_MODE_LIFO | IT_MODE_KEEP'), 143 | array(\SplDoublyLinkedList::IT_MODE_FIFO | \SplDoublyLinkedList::IT_MODE_DELETE, 'IT_MODE_FIFO | IT_MODE_DELETE'), 144 | array(\SplDoublyLinkedList::IT_MODE_LIFO | \SplDoublyLinkedList::IT_MODE_DELETE, 'IT_MODE_LIFO | IT_MODE_DELETE'), 145 | ); 146 | } 147 | 148 | public function testCastObjectStorageIsntModified() 149 | { 150 | $var = new \SplObjectStorage(); 151 | $var->attach(new \stdClass()); 152 | $var->rewind(); 153 | $current = $var->current(); 154 | 155 | $this->assertDumpMatchesFormat('%A', $var); 156 | $this->assertSame($current, $var->current()); 157 | } 158 | 159 | public function testCastObjectStorageDumpsInfo() 160 | { 161 | $var = new \SplObjectStorage(); 162 | $var->attach(new \stdClass(), new \DateTime()); 163 | 164 | $this->assertDumpMatchesFormat('%ADateTime%A', $var); 165 | } 166 | } 167 | -------------------------------------------------------------------------------- /code/vendor/symfony/polyfill-mbstring/bootstrap.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | use Symfony\Polyfill\Mbstring as p; 13 | 14 | if (!function_exists('mb_strlen')) { 15 | define('MB_CASE_UPPER', 0); 16 | define('MB_CASE_LOWER', 1); 17 | define('MB_CASE_TITLE', 2); 18 | 19 | function mb_convert_encoding($s, $to, $from = null) { return p\Mbstring::mb_convert_encoding($s, $to, $from); } 20 | function mb_decode_mimeheader($s) { return p\Mbstring::mb_decode_mimeheader($s); } 21 | function mb_encode_mimeheader($s, $charset = null, $transferEnc = null, $lf = null, $indent = null) { return p\Mbstring::mb_encode_mimeheader($s, $charset, $transferEnc, $lf, $indent); } 22 | function mb_decode_numericentity($s, $convmap, $enc = null) { return p\Mbstring::mb_decode_numericentity($s, $convmap, $enc); } 23 | function mb_encode_numericentity($s, $convmap, $enc = null, $is_hex = false) { return p\Mbstring::mb_encode_numericentity($s, $convmap, $enc, $is_hex); } 24 | function mb_convert_case($s, $mode, $enc = null) { return p\Mbstring::mb_convert_case($s, $mode, $enc); } 25 | function mb_internal_encoding($enc = null) { return p\Mbstring::mb_internal_encoding($enc); } 26 | function mb_language($lang = null) { return p\Mbstring::mb_language($lang); } 27 | function mb_list_encodings() { return p\Mbstring::mb_list_encodings(); } 28 | function mb_encoding_aliases($encoding) { return p\Mbstring::mb_encoding_aliases($encoding); } 29 | function mb_check_encoding($var = null, $encoding = null) { return p\Mbstring::mb_check_encoding($var, $encoding); } 30 | function mb_detect_encoding($str, $encodingList = null, $strict = false) { return p\Mbstring::mb_detect_encoding($str, $encodingList, $strict); } 31 | function mb_detect_order($encodingList = null) { return p\Mbstring::mb_detect_order($encodingList); } 32 | function mb_parse_str($s, &$result = array()) { parse_str($s, $result); } 33 | function mb_strlen($s, $enc = null) { return p\Mbstring::mb_strlen($s, $enc); } 34 | function mb_strpos($s, $needle, $offset = 0, $enc = null) { return p\Mbstring::mb_strpos($s, $needle, $offset, $enc); } 35 | function mb_strtolower($s, $enc = null) { return p\Mbstring::mb_strtolower($s, $enc); } 36 | function mb_strtoupper($s, $enc = null) { return p\Mbstring::mb_strtoupper($s, $enc); } 37 | function mb_substitute_character($char = null) { return p\Mbstring::mb_substitute_character($char); } 38 | function mb_substr($s, $start, $length = 2147483647, $enc = null) { return p\Mbstring::mb_substr($s, $start, $length, $enc); } 39 | function mb_stripos($s, $needle, $offset = 0, $enc = null) { return p\Mbstring::mb_stripos($s, $needle, $offset, $enc); } 40 | function mb_stristr($s, $needle, $part = false, $enc = null) { return p\Mbstring::mb_stristr($s, $needle, $part, $enc); } 41 | function mb_strrchr($s, $needle, $part = false, $enc = null) { return p\Mbstring::mb_strrchr($s, $needle, $part, $enc); } 42 | function mb_strrichr($s, $needle, $part = false, $enc = null) { return p\Mbstring::mb_strrichr($s, $needle, $part, $enc); } 43 | function mb_strripos($s, $needle, $offset = 0, $enc = null) { return p\Mbstring::mb_strripos($s, $needle, $offset, $enc); } 44 | function mb_strrpos($s, $needle, $offset = 0, $enc = null) { return p\Mbstring::mb_strrpos($s, $needle, $offset, $enc); } 45 | function mb_strstr($s, $needle, $part = false, $enc = null) { return p\Mbstring::mb_strstr($s, $needle, $part, $enc); } 46 | function mb_get_info($type = 'all') { return p\Mbstring::mb_get_info($type); } 47 | function mb_http_output($enc = null) { return p\Mbstring::mb_http_output($enc); } 48 | function mb_strwidth($s, $enc = null) { return p\Mbstring::mb_strwidth($s, $enc); } 49 | function mb_substr_count($haystack, $needle, $enc = null) { return p\Mbstring::mb_substr_count($haystack, $needle, $enc); } 50 | function mb_output_handler($contents, $status) { return p\Mbstring::mb_output_handler($contents, $status); } 51 | function mb_http_input($type = '') { return p\Mbstring::mb_http_input($type); } 52 | function mb_convert_variables($toEncoding, $fromEncoding, &$a = null, &$b = null, &$c = null, &$d = null, &$e = null, &$f = null) { return p\Mbstring::mb_convert_variables($toEncoding, $fromEncoding, $a, $b, $c, $d, $e, $f); } 53 | } 54 | if (!function_exists('mb_chr')) { 55 | function mb_ord($s, $enc = null) { return p\Mbstring::mb_ord($s, $enc); } 56 | function mb_chr($code, $enc = null) { return p\Mbstring::mb_chr($code, $enc); } 57 | function mb_scrub($s, $enc = null) { $enc = null === $enc ? mb_internal_encoding() : $enc; return mb_convert_encoding($s, $enc, $enc); } 58 | } 59 | -------------------------------------------------------------------------------- /css/webToast.css: -------------------------------------------------------------------------------- 1 | @charset "UTF-8"; 2 | 3 | /* flex */ 4 | .flex{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;} 5 | .flex-v{-webkit-box-orient:vertical;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;} 6 | .flex-1{-webkit-box-flex:1;-webkit-flex:1;-ms-flex:1;flex:1;} 7 | .flex-align-center{-webkit-box-align:center;-webkit-align-items:center;-ms-flex-align:center;align-items:center;} 8 | .flex-pack-center{-webkit-box-pack:center;-webkit-justify-content:flex-start;-ms-flex-pack:center;justify-content:flex-start;} 9 | .flex-pack-justify{-webkit-box-pack:justify;-webkit-justify-content:space-between;-ms-flex-pack:justify;justify-content:space-between;} 10 | .flex-box { display: -webkit-box;display: -moz-box;display: -ms-flexbox;display: -webkit-flex;display: flex;-moz-box-orient: horizontal;-webkit-box-orient: horizontal;-o-box-orient: horizontal;box-orient: horizontal;} 11 | /*遮罩*/ 12 | .mask{position: fixed;width: 100%;height: 100%;left: 0;top: 0;bottom: 0;background-color: rgba(0,0,0,0.8);z-index: 999;} 13 | 14 | 15 | 16 | /* 错误提示弹层 */ 17 | .c-float-modePop { 18 | text-align: center; 19 | background-color: #FAFAFC; 20 | } 21 | .c-float-modePop .warnMsg { 22 | 23 | padding: 20px 10px 10px 10px; 24 | color: #fff 25 | } 26 | .c-float-modePop .doBtn { 27 | 28 | width: 100%; 29 | margin: 0 auto; 30 | } 31 | .c-float-modePop button { 32 | 33 | padding: 6px 9px 6px 9px; 34 | color: #949494; 35 | border: 0; 36 | } 37 | .c-float-shade { 38 | 39 | width: 100%; 40 | display: block; 41 | position: absolute; 42 | z-index: 99; 43 | background-color: #000; 44 | opacity: .5; 45 | top: 0; 46 | left: 0 47 | } 48 | .c-float-shade.hide { 49 | display: none 50 | } 51 | .c-float-popWrap { 52 | width: 85%; 53 | z-index: 9999; 54 | position: fixed; 55 | border-radius: 3px; 56 | overflow: hidden; 57 | } 58 | .c-float-popWrap .c-float-modePop { 59 | overflow: hidden; 60 | border-radius: 6px; 61 | } 62 | .c-float-popWrap .c-float-modePop .warnMsg { 63 | padding: 0.8em 0 0.8em; 64 | font-size: 15px; 65 | color: #333; 66 | } 67 | .c-float-popWrap .c-float-modePop .content { 68 | padding: 0 20px; 69 | font-size: 14px; 70 | color: #888; 71 | word-wrap: break-word; 72 | word-break: break-all; 73 | text-align: left; 74 | } 75 | .c-float-popWrap .c-float-modePop .doBtn { 76 | width: 100%; 77 | margin-top: 15px; 78 | position: relative; 79 | } 80 | .c-float-popWrap .c-float-modePop .doBtn:after { 81 | content: " "; 82 | position: absolute; 83 | left: 0; 84 | top: 0; 85 | width: 100%; 86 | height: 1px; 87 | border-top: 1px solid #D5D5D6; 88 | color: #D5D5D6; 89 | -webkit-transform-origin: 0 0; 90 | transform-origin: 0 0; 91 | -webkit-transform: scaleY(0.5); 92 | transform: scaleY(0.5); 93 | } 94 | .c-float-popWrap .c-float-modePop button { 95 | background-color: #FAFAFC; 96 | width: 50%; 97 | height: 42px; 98 | line-height: 42px; 99 | color: #444; 100 | font-size: 17px; 101 | border: 0; 102 | padding: 0; 103 | } 104 | .c-float-popWrap .c-float-modePop button.ok{ 105 | color: #0BB20C; 106 | } 107 | .c-float-popWrap .c-float-modePop button.cancel{ 108 | position: relative; 109 | } 110 | .c-float-popWrap .c-float-modePop button.cancel:after { 111 | content: " "; 112 | position: absolute; 113 | right: -1px; 114 | top: 0; 115 | width: 1px; 116 | height: 100%; 117 | border-left: 1px solid #D5D5D6; 118 | color: #D5D5D6; 119 | -webkit-transform-origin: 0 0; 120 | transform-origin: 0 0; 121 | -webkit-transform: scaleX(0.5); 122 | transform: scaleX(0.5); 123 | } 124 | .c-float-popWrap.hide { 125 | 126 | display: none; 127 | -webkit-box-shadow: none 128 | } 129 | .c-float-popWrap.show { 130 | 131 | display: block; 132 | } 133 | 134 | .c-float-popWrap.msgMode .c-float-modePop .content, .c-float-popWrap.msgMode .c-float-modePop .doBtn { 135 | 136 | display: none 137 | } 138 | 139 | .c-float-popWrap.alertMode .c-float-modePop .doBtn .cancel { 140 | 141 | display: none 142 | } 143 | .c-float-popWrap.confirmMode .c-float-modePop .content, .c-float-popWrap.confirmMode .c-float-modePop .doBtn { 144 | 145 | display: block 146 | } 147 | 148 | .confirm_input{ 149 | border: 1px solid #D5D5D6; 150 | padding: 10px; 151 | width: 70%; 152 | } 153 | .weui_mask_transparent { 154 | position: fixed; 155 | z-index: -1; 156 | width: 100%; 157 | height: 100%; 158 | top: 0; 159 | left: 0; 160 | background: rgba(0, 0, 0, 0.6); 161 | } 162 | .cx_mask_transparent{ 163 | position: fixed; 164 | z-index: -1; 165 | width: 100%; 166 | height: 100%; 167 | top: 0; 168 | left: 0; 169 | background: rgba(255, 255, 255, 0.1); 170 | } 171 | 172 | .web_toast{ 173 | position: fixed; 174 | margin: 0 10px; 175 | z-index: 9999; 176 | display: none; 177 | display: block; 178 | padding: 10px 30px; 179 | color: #FFFFFF; 180 | background: rgba(0, 0, 0, 0.7); 181 | font-size: 1.8rem; 182 | text-align: center; 183 | border-radius: 4px; 184 | } 185 | -------------------------------------------------------------------------------- /code/src/App/ResultContainer.php: -------------------------------------------------------------------------------- 1 | conf; 40 | } 41 | 42 | /** 43 | * @param mixed $config 44 | */ 45 | public function setConf( $conf ){ 46 | $this->conf = $conf; 47 | } 48 | 49 | /** 50 | * @return mixed 51 | */ 52 | public function getImagePath(){ 53 | return $this->imagePath; 54 | } 55 | 56 | /** 57 | * @param mixed $imagePath 58 | */ 59 | public function setImagePath( $imagePath ){ 60 | $this->imagePath = $imagePath; 61 | } 62 | 63 | /** 64 | * @return mixed 65 | */ 66 | public function getMode(){ 67 | return $this->mode; 68 | } 69 | 70 | /** 71 | * @param mixed $mode 72 | */ 73 | public function setMode( $mode ){ 74 | $this->mode = $mode; 75 | } 76 | 77 | /** 78 | * @return mixed 79 | */ 80 | public function getImageInfo(){ 81 | return $this->imageInfo; 82 | } 83 | 84 | /** 85 | * @param mixed $imageInfo 86 | */ 87 | public function setImageInfo( $imageInfo ){ 88 | $this->imageInfo = $imageInfo; 89 | } 90 | 91 | /** 92 | * @return mixed 93 | */ 94 | public function getImage(){ 95 | return $this->image; 96 | } 97 | 98 | /** 99 | * @param mixed $image 100 | */ 101 | public function setImage( $image ){ 102 | $this->image = $image; 103 | } 104 | 105 | public function unsetImage(){ 106 | imagedestroy( $this->image ); 107 | unset( $this->image ); 108 | } 109 | 110 | /** 111 | * @return mixed 112 | */ 113 | public function getImageBinaryArr(){ 114 | return $this->imageBinaryArr; 115 | } 116 | 117 | /** 118 | * @param mixed $imageBinaryArr 119 | */ 120 | public function setImageBinaryArr( $imageBinaryArr ){ 121 | $this->imageBinaryArr = $imageBinaryArr; 122 | } 123 | 124 | /** 125 | * @return mixed 126 | */ 127 | public function getNoiseCancelArr(){ 128 | return $this->noiseCancelArr; 129 | } 130 | 131 | /** 132 | * @param mixed $noiseCancelArr 133 | */ 134 | public function setNoiseCancelArr( $noiseCancelArr ){ 135 | $this->noiseCancelArr = $noiseCancelArr; 136 | } 137 | 138 | /** 139 | * @return mixed 140 | */ 141 | public function getCoordinate(){ 142 | return $this->coordinate; 143 | } 144 | 145 | /** 146 | * @param mixed $coordinate 147 | */ 148 | public function setCoordinate( $coordinate ){ 149 | $this->coordinate = $coordinate; 150 | } 151 | 152 | /** 153 | * @return mixed 154 | */ 155 | public function getCharPixedCollection(){ 156 | return $this->charPixedCollection; 157 | } 158 | 159 | /** 160 | * @param mixed $charPixedCollection 161 | */ 162 | public function setCharPixedCollection( $charPixedCollection ){ 163 | $this->charPixedCollection = $charPixedCollection; 164 | } 165 | 166 | /** 167 | * @return mixed 168 | */ 169 | public function getOneDCharStrArr(){ 170 | return $this->oneDCharStrArr; 171 | } 172 | 173 | /** 174 | * @param mixed $oneDCharStrArr 175 | */ 176 | public function setOneDCharStrArr( $oneDCharStrArr ){ 177 | $this->oneDCharStrArr = $oneDCharStrArr; 178 | } 179 | 180 | /** 181 | * @return mixed 182 | */ 183 | public function getJudgeDetails(){ 184 | return $this->judgeDetails; 185 | } 186 | 187 | /** 188 | * @param mixed $judgeDetails 189 | */ 190 | public function setJudgeDetails( $key,$judgeDetails ){ 191 | $this->judgeDetails[$key] = $judgeDetails; 192 | } 193 | 194 | /** 195 | * @return mixed 196 | */ 197 | public function getResultArr(){ 198 | return $this->resultArr; 199 | } 200 | 201 | /** 202 | * @param mixed $resultArr 203 | */ 204 | public function setResultArr( $resultStrArr ){ 205 | $this->resultArr[] = $resultStrArr; 206 | } 207 | 208 | 209 | /** 210 | * @return mixed 211 | */ 212 | public function getResultStr(){ 213 | return $this->resultStr; 214 | } 215 | 216 | /** 217 | * @param mixed $resultStr 218 | */ 219 | public function setResultStr( $resultStr ){ 220 | $this->resultStr = $resultStr; 221 | } 222 | 223 | } -------------------------------------------------------------------------------- /code/vendor/symfony/var-dumper/Caster/DateCaster.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\VarDumper\Caster; 13 | 14 | use Symfony\Component\VarDumper\Cloner\Stub; 15 | 16 | /** 17 | * Casts DateTimeInterface related classes to array representation. 18 | * 19 | * @author Dany Maillard 20 | */ 21 | class DateCaster 22 | { 23 | public static function castDateTime(\DateTimeInterface $d, array $a, Stub $stub, $isNested, $filter) 24 | { 25 | $prefix = Caster::PREFIX_VIRTUAL; 26 | $location = $d->getTimezone()->getLocation(); 27 | $fromNow = (new \DateTime())->diff($d); 28 | 29 | $title = $d->format('l, F j, Y') 30 | ."\n".self::formatInterval($fromNow).' from now' 31 | .($location ? ($d->format('I') ? "\nDST On" : "\nDST Off") : '') 32 | ; 33 | 34 | $a = array(); 35 | $a[$prefix.'date'] = new ConstStub(self::formatDateTime($d, $location ? ' e (P)' : ' P'), $title); 36 | 37 | $stub->class .= $d->format(' @U'); 38 | 39 | return $a; 40 | } 41 | 42 | public static function castInterval(\DateInterval $interval, array $a, Stub $stub, $isNested, $filter) 43 | { 44 | $now = new \DateTimeImmutable(); 45 | $numberOfSeconds = $now->add($interval)->getTimestamp() - $now->getTimestamp(); 46 | $title = number_format($numberOfSeconds, 0, '.', ' ').'s'; 47 | 48 | $i = array(Caster::PREFIX_VIRTUAL.'interval' => new ConstStub(self::formatInterval($interval), $title)); 49 | 50 | return $filter & Caster::EXCLUDE_VERBOSE ? $i : $i + $a; 51 | } 52 | 53 | private static function formatInterval(\DateInterval $i) 54 | { 55 | $format = '%R '; 56 | 57 | if (0 === $i->y && 0 === $i->m && ($i->h >= 24 || $i->i >= 60 || $i->s >= 60)) { 58 | $i = date_diff($d = new \DateTime(), date_add(clone $d, $i)); // recalculate carry over points 59 | $format .= 0 < $i->days ? '%ad ' : ''; 60 | } else { 61 | $format .= ($i->y ? '%yy ' : '').($i->m ? '%mm ' : '').($i->d ? '%dd ' : ''); 62 | } 63 | 64 | if (\PHP_VERSION_ID >= 70100 && isset($i->f)) { 65 | $format .= $i->h || $i->i || $i->s || $i->f ? '%H:%I:'.self::formatSeconds($i->s, substr($i->f, 2)) : ''; 66 | } else { 67 | $format .= $i->h || $i->i || $i->s ? '%H:%I:%S' : ''; 68 | } 69 | 70 | $format = '%R ' === $format ? '0s' : $format; 71 | 72 | return $i->format(rtrim($format)); 73 | } 74 | 75 | public static function castTimeZone(\DateTimeZone $timeZone, array $a, Stub $stub, $isNested, $filter) 76 | { 77 | $location = $timeZone->getLocation(); 78 | $formatted = (new \DateTime('now', $timeZone))->format($location ? 'e (P)' : 'P'); 79 | $title = $location && extension_loaded('intl') ? \Locale::getDisplayRegion('-'.$location['country_code'], \Locale::getDefault()) : ''; 80 | 81 | $z = array(Caster::PREFIX_VIRTUAL.'timezone' => new ConstStub($formatted, $title)); 82 | 83 | return $filter & Caster::EXCLUDE_VERBOSE ? $z : $z + $a; 84 | } 85 | 86 | public static function castPeriod(\DatePeriod $p, array $a, Stub $stub, $isNested, $filter) 87 | { 88 | if (defined('HHVM_VERSION_ID') || \PHP_VERSION_ID < 50620 || (\PHP_VERSION_ID >= 70000 && \PHP_VERSION_ID < 70005)) { // see https://bugs.php.net/bug.php?id=71635 89 | return $a; 90 | } 91 | 92 | $dates = array(); 93 | if (\PHP_VERSION_ID >= 70107) { // see https://bugs.php.net/bug.php?id=74639 94 | foreach (clone $p as $i => $d) { 95 | if (3 === $i) { 96 | $now = new \DateTimeImmutable(); 97 | $dates[] = sprintf('%s more', ($end = $p->getEndDate()) 98 | ? ceil(($end->format('U.u') - $d->format('U.u')) / ($now->add($p->getDateInterval())->format('U.u') - $now->format('U.u'))) 99 | : $p->recurrences - $i 100 | ); 101 | break; 102 | } 103 | $dates[] = sprintf('%s) %s', $i + 1, self::formatDateTime($d)); 104 | } 105 | } 106 | 107 | $period = sprintf( 108 | 'every %s, from %s (%s) %s', 109 | self::formatInterval($p->getDateInterval()), 110 | self::formatDateTime($p->getStartDate()), 111 | $p->include_start_date ? 'included' : 'excluded', 112 | ($end = $p->getEndDate()) ? 'to '.self::formatDateTime($end) : 'recurring '.$p->recurrences.' time/s' 113 | ); 114 | 115 | $p = array(Caster::PREFIX_VIRTUAL.'period' => new ConstStub($period, implode("\n", $dates))); 116 | 117 | return $filter & Caster::EXCLUDE_VERBOSE ? $p : $p + $a; 118 | } 119 | 120 | private static function formatDateTime(\DateTimeInterface $d, $extra = '') 121 | { 122 | return $d->format('Y-m-d H:i:'.self::formatSeconds($d->format('s'), $d->format('u')).$extra); 123 | } 124 | 125 | private static function formatSeconds($s, $us) 126 | { 127 | return sprintf('%02d.%s', $s, 0 === ($len = strlen($t = rtrim($us, '0'))) ? '0' : ($len <= 3 ? str_pad($t, 3, '0') : $us)); 128 | } 129 | } 130 | -------------------------------------------------------------------------------- /code/composer.lock: -------------------------------------------------------------------------------- 1 | { 2 | "_readme": [ 3 | "This file locks the dependencies of your project to a known state", 4 | "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", 5 | "This file is @generated automatically" 6 | ], 7 | "content-hash": "b15fd407c3b8c4b11070754a6c646268", 8 | "packages": [ 9 | { 10 | "name": "symfony/polyfill-mbstring", 11 | "version": "v1.8.0", 12 | "source": { 13 | "type": "git", 14 | "url": "https://github.com/symfony/polyfill-mbstring.git", 15 | "reference": "3296adf6a6454a050679cde90f95350ad604b171" 16 | }, 17 | "dist": { 18 | "type": "zip", 19 | "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/3296adf6a6454a050679cde90f95350ad604b171", 20 | "reference": "3296adf6a6454a050679cde90f95350ad604b171", 21 | "shasum": "" 22 | }, 23 | "require": { 24 | "php": ">=5.3.3" 25 | }, 26 | "suggest": { 27 | "ext-mbstring": "For best performance" 28 | }, 29 | "type": "library", 30 | "extra": { 31 | "branch-alias": { 32 | "dev-master": "1.8-dev" 33 | } 34 | }, 35 | "autoload": { 36 | "psr-4": { 37 | "Symfony\\Polyfill\\Mbstring\\": "" 38 | }, 39 | "files": [ 40 | "bootstrap.php" 41 | ] 42 | }, 43 | "notification-url": "https://packagist.org/downloads/", 44 | "license": [ 45 | "MIT" 46 | ], 47 | "authors": [ 48 | { 49 | "name": "Nicolas Grekas", 50 | "email": "p@tchwork.com" 51 | }, 52 | { 53 | "name": "Symfony Community", 54 | "homepage": "https://symfony.com/contributors" 55 | } 56 | ], 57 | "description": "Symfony polyfill for the Mbstring extension", 58 | "homepage": "https://symfony.com", 59 | "keywords": [ 60 | "compatibility", 61 | "mbstring", 62 | "polyfill", 63 | "portable", 64 | "shim" 65 | ], 66 | "time": "2018-04-26T10:06:28+00:00" 67 | }, 68 | { 69 | "name": "symfony/var-dumper", 70 | "version": "v3.4.9", 71 | "source": { 72 | "type": "git", 73 | "url": "https://github.com/symfony/var-dumper.git", 74 | "reference": "0e6545672d8c9ce70dd472adc2f8b03155a46f73" 75 | }, 76 | "dist": { 77 | "type": "zip", 78 | "url": "https://api.github.com/repos/symfony/var-dumper/zipball/0e6545672d8c9ce70dd472adc2f8b03155a46f73", 79 | "reference": "0e6545672d8c9ce70dd472adc2f8b03155a46f73", 80 | "shasum": "" 81 | }, 82 | "require": { 83 | "php": "^5.5.9|>=7.0.8", 84 | "symfony/polyfill-mbstring": "~1.0" 85 | }, 86 | "conflict": { 87 | "phpunit/phpunit": "<4.8.35|<5.4.3,>=5.0" 88 | }, 89 | "require-dev": { 90 | "ext-iconv": "*", 91 | "twig/twig": "~1.34|~2.4" 92 | }, 93 | "suggest": { 94 | "ext-iconv": "To convert non-UTF-8 strings to UTF-8 (or symfony/polyfill-iconv in case ext-iconv cannot be used).", 95 | "ext-intl": "To show region name in time zone dump", 96 | "ext-symfony_debug": "" 97 | }, 98 | "type": "library", 99 | "extra": { 100 | "branch-alias": { 101 | "dev-master": "3.4-dev" 102 | } 103 | }, 104 | "autoload": { 105 | "files": [ 106 | "Resources/functions/dump.php" 107 | ], 108 | "psr-4": { 109 | "Symfony\\Component\\VarDumper\\": "" 110 | }, 111 | "exclude-from-classmap": [ 112 | "/Tests/" 113 | ] 114 | }, 115 | "notification-url": "https://packagist.org/downloads/", 116 | "license": [ 117 | "MIT" 118 | ], 119 | "authors": [ 120 | { 121 | "name": "Nicolas Grekas", 122 | "email": "p@tchwork.com" 123 | }, 124 | { 125 | "name": "Symfony Community", 126 | "homepage": "https://symfony.com/contributors" 127 | } 128 | ], 129 | "description": "Symfony mechanism for exploring and dumping PHP variables", 130 | "homepage": "https://symfony.com", 131 | "keywords": [ 132 | "debug", 133 | "dump" 134 | ], 135 | "time": "2018-04-26T12:42:15+00:00" 136 | } 137 | ], 138 | "packages-dev": [], 139 | "aliases": [], 140 | "minimum-stability": "stable", 141 | "stability-flags": [], 142 | "prefer-stable": false, 143 | "prefer-lowest": false, 144 | "platform": [], 145 | "platform-dev": [] 146 | } 147 | -------------------------------------------------------------------------------- /code/vendor/composer/autoload_static.php: -------------------------------------------------------------------------------- 1 | __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php', 11 | '667aeda72477189d0494fecd327c3641' => __DIR__ . '/..' . '/symfony/var-dumper/Resources/functions/dump.php', 12 | ); 13 | 14 | public static $prefixLengthsPsr4 = array ( 15 | 'S' => 16 | array ( 17 | 'Symfony\\Polyfill\\Mbstring\\' => 26, 18 | 'Symfony\\Component\\VarDumper\\' => 28, 19 | ), 20 | 'A' => 21 | array ( 22 | 'App\\' => 4, 23 | ), 24 | ); 25 | 26 | public static $prefixDirsPsr4 = array ( 27 | 'Symfony\\Polyfill\\Mbstring\\' => 28 | array ( 29 | 0 => __DIR__ . '/..' . '/symfony/polyfill-mbstring', 30 | ), 31 | 'Symfony\\Component\\VarDumper\\' => 32 | array ( 33 | 0 => __DIR__ . '/..' . '/symfony/var-dumper', 34 | ), 35 | 'App\\' => 36 | array ( 37 | 0 => __DIR__ . '/../..' . '/app', 38 | ), 39 | ); 40 | 41 | public static $classMap = array ( 42 | 'CAPTCHAReader\\Training\\AddSamples\\AddSamplesAuto\\AddSamplesAuto' => __DIR__ . '/../..' . '/training/AddSamples/AddSamplesAuto.php', 43 | 'CAPTCHAReader\\Training\\AddSamples\\AddSamplesAuto\\Test' => __DIR__ . '/../..' . '/training/AddSamples/Test.php', 44 | 'CAPTCHAReader\\Training\\MultiplesTests\\NormalMultiplesTests\\NormalMultipleTests' => __DIR__ . '/../..' . '/training/MultipleTests/NormalMultipleTests.php', 45 | 'CAPTCHAReader\\Training\\MultiplesTests\\NormalMultiplesTests\\NormalMultipleTests\\Test' => __DIR__ . '/../..' . '/training/MultipleTests/Test.php', 46 | 'CAPTCHAReader\\src\\App\\Abstracts\\Load' => __DIR__ . '/../..' . '/src/Abstracts/Load.php', 47 | 'CAPTCHAReader\\src\\App\\Abstracts\\Restriction' => __DIR__ . '/../..' . '/src/Abstracts/Restriction.php', 48 | 'CAPTCHAReader\\src\\App\\Cutting\\CuttingZhengFangFixed' => __DIR__ . '/../..' . '/src/App/Cutting/CuttingZhengFangFixed.php', 49 | 'CAPTCHAReader\\src\\App\\Cutting\\CuttingZhengFangMove' => __DIR__ . '/../..' . '/src/App/Cutting/CuttingZhengFangMove.php', 50 | 'CAPTCHAReader\\src\\App\\GetImageInfo\\GetImageInfo' => __DIR__ . '/../..' . '/src/App/GetImageInfo/GetImageInfo.php', 51 | 'CAPTCHAReader\\src\\App\\Identify\\IdentifyZhengFangCol' => __DIR__ . '/../..' . '/src/App/Identify/IdentifyZhengFangCol.php', 52 | 'CAPTCHAReader\\src\\App\\Identify\\IdentifyZhengFangColLevenshtein' => __DIR__ . '/../..' . '/src/App/Identify/IdentifyZhengFangColLevenshtein.php', 53 | 'CAPTCHAReader\\src\\App\\IndexController' => __DIR__ . '/../..' . '/src/App/IndexController.php', 54 | 'CAPTCHAReader\\src\\App\\Pretreatment\\PretreatmentZhengFang' => __DIR__ . '/../..' . '/src/App/Pretreatment/PretreatmentZhengFang.php', 55 | 'CAPTCHAReader\\src\\App\\ResultContainer' => __DIR__ . '/../..' . '/src/App/ResultContainer.php', 56 | 'CAPTCHAReader\\src\\Log\\Log' => __DIR__ . '/../..' . '/src/Log/Log.php', 57 | 'CAPTCHAReader\\src\\Repository\\Cutting\\CuttingZhengFangFixedRepository' => __DIR__ . '/../..' . '/src/Repositories/Cutting/CuttingZhengFangFixedRepository.php', 58 | 'CAPTCHAReader\\src\\Repository\\Cutting\\CuttingZhengFangMoveRepository' => __DIR__ . '/../..' . '/src/Repositories/Cutting/CuttingZhengFangMoveRepository.php', 59 | 'CAPTCHAReader\\src\\Repository\\Identify\\IdentifyZhengFangColLevenshteinRepository' => __DIR__ . '/../..' . '/src/Repositories/Identify/IdentifyZhengFangColLevenshteinRepository.php', 60 | 'CAPTCHAReader\\src\\Repository\\Identify\\IdentifyZhengFangColRepository' => __DIR__ . '/../..' . '/src/Repositories/Identify/IdentifyZhengFangColRepository.php', 61 | 'CAPTCHAReader\\src\\Repository\\Pretreatment\\PretreatmentQinGuoRepository' => __DIR__ . '/../..' . '/src/Repositories/Pretreatment/PretreatmentQinGuoRepository.php', 62 | 'CAPTCHAReader\\src\\Repository\\Pretreatment\\PretreatmentZhengFangRepository' => __DIR__ . '/../..' . '/src/Repositories/Pretreatment/PretreatmentZhengFangRepository.php', 63 | 'CAPTCHAReader\\src\\Traits\\CommonTrait' => __DIR__ . '/../..' . '/src/Trait/CommonTrait.php', 64 | 'CAPTCHAReader\\src\\Traits\\CuttingTrait' => __DIR__ . '/../..' . '/src/Trait/CuttingTrait.php', 65 | 'CAPTCHAReader\\src\\Traits\\GetImageInfoTrait' => __DIR__ . '/../..' . '/src/Trait/GetImageInfoTrait.php', 66 | 'CAPTCHAReader\\src\\Traits\\IdentifyTrait' => __DIR__ . '/../..' . '/src/Trait/IdentifyTrait.php', 67 | 'CAPTCHAReader\\src\\Traits\\PretreatmentTrait' => __DIR__ . '/../..' . '/src/Trait/PretreatmentTrait.php', 68 | 'CAPTCHAReader\\training\\Abstracts\\TestsInterface' => __DIR__ . '/../..' . '/training/Abstracts/TestsInterface.php', 69 | 'CAPTCHAReader\\training\\Traits\\CommonTrait' => __DIR__ . '/../..' . '/training/Trait/CommonTrait.php', 70 | ); 71 | 72 | public static function getInitializer(ClassLoader $loader) 73 | { 74 | return \Closure::bind(function () use ($loader) { 75 | $loader->prefixLengthsPsr4 = ComposerStaticInit5e7b21114a6d8530f6f5b9dd9c3e2fec::$prefixLengthsPsr4; 76 | $loader->prefixDirsPsr4 = ComposerStaticInit5e7b21114a6d8530f6f5b9dd9c3e2fec::$prefixDirsPsr4; 77 | $loader->classMap = ComposerStaticInit5e7b21114a6d8530f6f5b9dd9c3e2fec::$classMap; 78 | 79 | }, null, ClassLoader::class); 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /code/vendor/symfony/var-dumper/Tests/Caster/XmlReaderCasterTest.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\VarDumper\Tests\Caster; 13 | 14 | use PHPUnit\Framework\TestCase; 15 | use Symfony\Component\VarDumper\Test\VarDumperTestTrait; 16 | 17 | /** 18 | * @author Baptiste Clavié 19 | */ 20 | class XmlReaderCasterTest extends TestCase 21 | { 22 | use VarDumperTestTrait; 23 | 24 | /** @var \XmlReader */ 25 | private $reader; 26 | 27 | protected function setUp() 28 | { 29 | $this->reader = new \XmlReader(); 30 | $this->reader->open(__DIR__.'/../Fixtures/xml_reader.xml'); 31 | } 32 | 33 | protected function tearDown() 34 | { 35 | $this->reader->close(); 36 | } 37 | 38 | public function testParserProperty() 39 | { 40 | $this->reader->setParserProperty(\XMLReader::SUBST_ENTITIES, true); 41 | 42 | $expectedDump = <<<'EODUMP' 43 | XMLReader { 44 | +nodeType: NONE 45 | parserProperties: { 46 | SUBST_ENTITIES: true 47 | …3 48 | } 49 | …12 50 | } 51 | EODUMP; 52 | 53 | $this->assertDumpMatchesFormat($expectedDump, $this->reader); 54 | } 55 | 56 | /** 57 | * @dataProvider provideNodes 58 | */ 59 | public function testNodes($seek, $expectedDump) 60 | { 61 | while ($seek--) { 62 | $this->reader->read(); 63 | } 64 | $this->assertDumpMatchesFormat($expectedDump, $this->reader); 65 | } 66 | 67 | public function provideNodes() 68 | { 69 | return array( 70 | array(0, <<<'EODUMP' 71 | XMLReader { 72 | +nodeType: NONE 73 | …13 74 | } 75 | EODUMP 76 | ), 77 | array(1, <<<'EODUMP' 78 | XMLReader { 79 | +localName: "foo" 80 | +nodeType: ELEMENT 81 | +baseURI: "%sxml_reader.xml" 82 | …11 83 | } 84 | EODUMP 85 | ), 86 | array(2, <<<'EODUMP' 87 | XMLReader { 88 | +localName: "#text" 89 | +nodeType: SIGNIFICANT_WHITESPACE 90 | +depth: 1 91 | +value: """ 92 | \n 93 | 94 | """ 95 | +baseURI: "%sxml_reader.xml" 96 | …9 97 | } 98 | EODUMP 99 | ), 100 | array(3, <<<'EODUMP' 101 | XMLReader { 102 | +localName: "bar" 103 | +nodeType: ELEMENT 104 | +depth: 1 105 | +baseURI: "%sxml_reader.xml" 106 | …10 107 | } 108 | EODUMP 109 | ), 110 | array(4, <<<'EODUMP' 111 | XMLReader { 112 | +localName: "bar" 113 | +nodeType: END_ELEMENT 114 | +depth: 1 115 | +baseURI: "%sxml_reader.xml" 116 | …10 117 | } 118 | EODUMP 119 | ), 120 | array(6, <<<'EODUMP' 121 | XMLReader { 122 | +localName: "bar" 123 | +nodeType: ELEMENT 124 | +depth: 1 125 | +isEmptyElement: true 126 | +baseURI: "%sxml_reader.xml" 127 | …9 128 | } 129 | EODUMP 130 | ), 131 | array(9, <<<'EODUMP' 132 | XMLReader { 133 | +localName: "#text" 134 | +nodeType: TEXT 135 | +depth: 2 136 | +value: "With text" 137 | +baseURI: "%sxml_reader.xml" 138 | …9 139 | } 140 | EODUMP 141 | ), 142 | array(12, <<<'EODUMP' 143 | XMLReader { 144 | +localName: "bar" 145 | +nodeType: ELEMENT 146 | +depth: 1 147 | +attributeCount: 2 148 | +baseURI: "%sxml_reader.xml" 149 | …9 150 | } 151 | EODUMP 152 | ), 153 | array(13, <<<'EODUMP' 154 | XMLReader { 155 | +localName: "bar" 156 | +nodeType: END_ELEMENT 157 | +depth: 1 158 | +baseURI: "%sxml_reader.xml" 159 | …10 160 | } 161 | EODUMP 162 | ), 163 | array(15, <<<'EODUMP' 164 | XMLReader { 165 | +localName: "bar" 166 | +nodeType: ELEMENT 167 | +depth: 1 168 | +attributeCount: 1 169 | +baseURI: "%sxml_reader.xml" 170 | …9 171 | } 172 | EODUMP 173 | ), 174 | array(16, <<<'EODUMP' 175 | XMLReader { 176 | +localName: "#text" 177 | +nodeType: SIGNIFICANT_WHITESPACE 178 | +depth: 2 179 | +value: """ 180 | \n 181 | 182 | """ 183 | +baseURI: "%sxml_reader.xml" 184 | …9 185 | } 186 | EODUMP 187 | ), 188 | array(17, <<<'EODUMP' 189 | XMLReader { 190 | +localName: "baz" 191 | +prefix: "baz" 192 | +nodeType: ELEMENT 193 | +depth: 2 194 | +namespaceURI: "http://symfony.com" 195 | +baseURI: "%sxml_reader.xml" 196 | …8 197 | } 198 | EODUMP 199 | ), 200 | array(18, <<<'EODUMP' 201 | XMLReader { 202 | +localName: "baz" 203 | +prefix: "baz" 204 | +nodeType: END_ELEMENT 205 | +depth: 2 206 | +namespaceURI: "http://symfony.com" 207 | +baseURI: "%sxml_reader.xml" 208 | …8 209 | } 210 | EODUMP 211 | ), 212 | array(19, <<<'EODUMP' 213 | XMLReader { 214 | +localName: "#text" 215 | +nodeType: SIGNIFICANT_WHITESPACE 216 | +depth: 2 217 | +value: """ 218 | \n 219 | 220 | """ 221 | +baseURI: "%sxml_reader.xml" 222 | …9 223 | } 224 | EODUMP 225 | ), 226 | array(21, <<<'EODUMP' 227 | XMLReader { 228 | +localName: "#text" 229 | +nodeType: SIGNIFICANT_WHITESPACE 230 | +depth: 1 231 | +value: "\n" 232 | +baseURI: "%sxml_reader.xml" 233 | …9 234 | } 235 | EODUMP 236 | ), 237 | array(22, <<<'EODUMP' 238 | XMLReader { 239 | +localName: "foo" 240 | +nodeType: END_ELEMENT 241 | +baseURI: "%sxml_reader.xml" 242 | …11 243 | } 244 | EODUMP 245 | ), 246 | ); 247 | } 248 | } 249 | -------------------------------------------------------------------------------- /code/function.php: -------------------------------------------------------------------------------- 1 | '', //远程请求的页面, 等同于 html 表单中的 action; 12 | 'method'=>'get', //数据传输方式: post 和 get(默认); 13 | 'data'=>'', //HTTP请求中的数据, 支持数组和 name=value 方式的 url 查询字符串, 要发送文件,在文件名前面加上@前缀并使用完整路径。; 14 | 'cookie'=>'', //HTTP请求中"Cookie: "部分的内容。多个cookie用分号分隔,分号后带一个空格(例如, "fruit=apple; colour=red"); 15 | 'referer'=>'', //HTTP请求头中"Referer: "的内容 16 | 'userAgent'=>'', //HTTP请求中包含一个"User-Agent: "头的字符串 17 | 'requestHeaders'=>array(), //用来设置 HTTP 请求头部字段的数组,形式: array('Content-type: text/plain', 'Content-length: 100') 18 | 'sessionCookie'=>false, //传输 cookie 时仅传输 Session Cookie 19 | 'autoReferer'=>true, //当根据 Location: 重定向时自动填写头部 Referer: 信息 20 | 'responseHeaders'=>false, //也将响应头部返回在文件流中 21 | 'sslVerify'=>false, //SSL 安全证书验证 22 | 'timeout'=>30, //设置超时; 23 | 'username'=>'', //http 登录方式的用户名; 24 | 'password'=>'' //http 登录方式的密码; 25 | ); 26 | $aArg = array_merge($default, $aArg); 27 | $ch = curl_init(); 28 | curl_setopt($ch, CURLOPT_URL, $aArg['url']); 29 | curl_setopt($ch, CURLOPT_COOKIESESSION, $aArg['sessionCookie']); 30 | curl_setopt($ch, CURLOPT_AUTOREFERER, $aArg['autoReferer']); 31 | curl_setopt($ch, CURLOPT_HEADER, $aArg['responseHeaders']); 32 | curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/4"); 33 | curl_setopt($ch,CURLOPT_FOLLOWLOCATION,true); 34 | curl_setopt($ch, CURLOPT_TIMEOUT, $aArg['timeout']); 35 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 36 | if(strtolower($aArg['method']) == 'post') { 37 | curl_setopt($ch, CURLOPT_POST, 1); 38 | curl_setopt($ch, CURLOPT_POSTFIELDS, $aArg['data']); 39 | }else{ 40 | if($aArg['data'] && (is_string($aArg['data']) || is_array($aArg['data']))) { 41 | $aArg['url'] .= (preg_match('/\?/', $aArg['url']) ? '&' : '?') . (is_string($aArg['data']) ? $aArg['data'] : http_build_query($aArg['data'])); 42 | } 43 | } 44 | if($aArg['sslVerify']){ 45 | curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 2); 46 | }else{ 47 | curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); 48 | } 49 | @curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, true); 50 | if($aArg['cookie']) curl_setopt($ch, CURLOPT_COOKIE, $aArg['cookie']); 51 | if($aArg['referer']) curl_setopt($ch, CURLOPT_REFERER, $aArg['referer']); 52 | if($aArg['userAgent']) curl_setopt($ch, CURLOPT_USERAGENT, $aArg['userAgent']); 53 | if(!empty($aArg['requestHeaders'])) curl_setopt($ch, CURLOPT_HTTPHEADER, $aArg['requestHeaders']); 54 | if($aArg['username'] && $aArg['password']) curl_setopt($ch, CURLOPT_USERPWD, '['.$aArg['username'].']:['.$aArg['password'].']'); 55 | $data = curl_exec($ch); 56 | if (curl_errno($ch)) return curl_error($ch); 57 | curl_close($ch); 58 | return $data; 59 | } 60 | 61 | /** 62 | * get_cookie() 函数用来获取相应头部中的 Cookie 63 | * @param string $sArg 可能包含 Cookie 的字符串 64 | * @return string 返回所有匹配的 Cookie 字符串 65 | */ 66 | function get_cookie($sArg='') 67 | { 68 | preg_match_all('/Cookie: (.*);/iU', $sArg, $aCookie); 69 | for($i=0, $sCookie=''; $i$sArg, 97 | 'method'=>'get', 98 | 'responseHeaders'=>1 99 | ); 100 | $result = curl_request($curlArg); 101 | return $result; 102 | } 103 | 104 | /** 105 | * captcha_new() 函数用来获取新版教务系统验证码 106 | * @param string $ip URL地址 107 | * @param string $sessionId 对应的sessionID 108 | * @return string 返回相应URL返回的内容 109 | */ 110 | function captcha_new($ip, $sessionId) 111 | { 112 | $curlArg = array( 113 | 'url' =>$ip.'/CheckCode.aspx', 114 | 'method' => 'get', 115 | 'cookie' => $sessionId, 116 | 'responseHeaders' => 0 117 | ); 118 | $result = curl_request($curlArg); 119 | return $result; 120 | } 121 | 122 | /** 123 | * captcha_old() 函数用来获取旧版教务系统验证码 124 | * @param string $ip URL地址 125 | * @param string $sessionId 对应的sessionID 126 | * @return string 返回相应URL返回的内容 127 | */ 128 | function captcha_old($ip, $sessionId) 129 | { 130 | $curlArg = array( 131 | 'url' => $ip.'/('.$sessionId.')/CheckCode.aspx', 132 | 'method' => 'get', 133 | 'responseHeaders' => 0 134 | ); 135 | $result = curl_request($curlArg); 136 | return $result; 137 | } 138 | 139 | /** 140 | * del_dir() 函数用来删除目录下的所有文件 141 | */ 142 | function del_dir($path) 143 | { 144 | if(is_dir($path)){ 145 | //扫描一个文件夹内的所有文件夹和文件并返回数组 146 | $p = scandir($path); 147 | foreach($p as $val){ 148 | //排除目录中的.和.. 149 | if($val !="." && $val !=".."){ 150 | //如果是目录则递归子目录,继续操作 151 | if(is_dir($path.$val)){ 152 | //子目录中操作删除文件夹和文件 153 | deldir($path.$val.'/'); 154 | //目录清空后删除空文件夹 155 | @rmdir($path.$val.'/'); 156 | }else{ 157 | //判断时间 158 | if (fileatime($path.$val) < time()-3600) { 159 | //如果是文件直接删除 160 | unlink($path.$val); 161 | } 162 | } 163 | } 164 | } 165 | } 166 | } 167 | 168 | 169 | -------------------------------------------------------------------------------- /code/vendor/symfony/var-dumper/Tests/Caster/CasterTest.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\VarDumper\Tests\Caster; 13 | 14 | use PHPUnit\Framework\TestCase; 15 | use Symfony\Component\VarDumper\Caster\Caster; 16 | use Symfony\Component\VarDumper\Test\VarDumperTestTrait; 17 | 18 | /** 19 | * @author Nicolas Grekas 20 | */ 21 | class CasterTest extends TestCase 22 | { 23 | use VarDumperTestTrait; 24 | 25 | private $referenceArray = array( 26 | 'null' => null, 27 | 'empty' => false, 28 | 'public' => 'pub', 29 | "\0~\0virtual" => 'virt', 30 | "\0+\0dynamic" => 'dyn', 31 | "\0*\0protected" => 'prot', 32 | "\0Foo\0private" => 'priv', 33 | ); 34 | 35 | /** 36 | * @dataProvider provideFilter 37 | */ 38 | public function testFilter($filter, $expectedDiff, $listedProperties = null) 39 | { 40 | if (null === $listedProperties) { 41 | $filteredArray = Caster::filter($this->referenceArray, $filter); 42 | } else { 43 | $filteredArray = Caster::filter($this->referenceArray, $filter, $listedProperties); 44 | } 45 | 46 | $this->assertSame($expectedDiff, array_diff_assoc($this->referenceArray, $filteredArray)); 47 | } 48 | 49 | public function provideFilter() 50 | { 51 | return array( 52 | array( 53 | 0, 54 | array(), 55 | ), 56 | array( 57 | Caster::EXCLUDE_PUBLIC, 58 | array( 59 | 'null' => null, 60 | 'empty' => false, 61 | 'public' => 'pub', 62 | ), 63 | ), 64 | array( 65 | Caster::EXCLUDE_NULL, 66 | array( 67 | 'null' => null, 68 | ), 69 | ), 70 | array( 71 | Caster::EXCLUDE_EMPTY, 72 | array( 73 | 'null' => null, 74 | 'empty' => false, 75 | ), 76 | ), 77 | array( 78 | Caster::EXCLUDE_VIRTUAL, 79 | array( 80 | "\0~\0virtual" => 'virt', 81 | ), 82 | ), 83 | array( 84 | Caster::EXCLUDE_DYNAMIC, 85 | array( 86 | "\0+\0dynamic" => 'dyn', 87 | ), 88 | ), 89 | array( 90 | Caster::EXCLUDE_PROTECTED, 91 | array( 92 | "\0*\0protected" => 'prot', 93 | ), 94 | ), 95 | array( 96 | Caster::EXCLUDE_PRIVATE, 97 | array( 98 | "\0Foo\0private" => 'priv', 99 | ), 100 | ), 101 | array( 102 | Caster::EXCLUDE_VERBOSE, 103 | array( 104 | 'public' => 'pub', 105 | "\0*\0protected" => 'prot', 106 | ), 107 | array('public', "\0*\0protected"), 108 | ), 109 | array( 110 | Caster::EXCLUDE_NOT_IMPORTANT, 111 | array( 112 | 'null' => null, 113 | 'empty' => false, 114 | "\0~\0virtual" => 'virt', 115 | "\0+\0dynamic" => 'dyn', 116 | "\0Foo\0private" => 'priv', 117 | ), 118 | array('public', "\0*\0protected"), 119 | ), 120 | array( 121 | Caster::EXCLUDE_VIRTUAL | Caster::EXCLUDE_DYNAMIC, 122 | array( 123 | "\0~\0virtual" => 'virt', 124 | "\0+\0dynamic" => 'dyn', 125 | ), 126 | ), 127 | array( 128 | Caster::EXCLUDE_NOT_IMPORTANT | Caster::EXCLUDE_VERBOSE, 129 | $this->referenceArray, 130 | array('public', "\0*\0protected"), 131 | ), 132 | array( 133 | Caster::EXCLUDE_NOT_IMPORTANT | Caster::EXCLUDE_EMPTY, 134 | array( 135 | 'null' => null, 136 | 'empty' => false, 137 | "\0~\0virtual" => 'virt', 138 | "\0+\0dynamic" => 'dyn', 139 | "\0*\0protected" => 'prot', 140 | "\0Foo\0private" => 'priv', 141 | ), 142 | array('public', 'empty'), 143 | ), 144 | array( 145 | Caster::EXCLUDE_VERBOSE | Caster::EXCLUDE_EMPTY | Caster::EXCLUDE_STRICT, 146 | array( 147 | 'empty' => false, 148 | ), 149 | array('public', 'empty'), 150 | ), 151 | ); 152 | } 153 | 154 | /** 155 | * @requires PHP 7.0 156 | */ 157 | public function testAnonymousClass() 158 | { 159 | $c = eval('return new class extends stdClass { private $foo = "foo"; };'); 160 | 161 | $this->assertDumpMatchesFormat( 162 | <<<'EOTXT' 163 | stdClass@anonymous { 164 | -foo: "foo" 165 | } 166 | EOTXT 167 | , $c 168 | ); 169 | 170 | $c = eval('return new class { private $foo = "foo"; };'); 171 | 172 | $this->assertDumpMatchesFormat( 173 | <<<'EOTXT' 174 | @anonymous { 175 | -foo: "foo" 176 | } 177 | EOTXT 178 | , $c 179 | ); 180 | } 181 | } 182 | -------------------------------------------------------------------------------- /code/vendor/symfony/var-dumper/Caster/PgSqlCaster.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\VarDumper\Caster; 13 | 14 | use Symfony\Component\VarDumper\Cloner\Stub; 15 | 16 | /** 17 | * Casts pqsql resources to array representation. 18 | * 19 | * @author Nicolas Grekas 20 | */ 21 | class PgSqlCaster 22 | { 23 | private static $paramCodes = array( 24 | 'server_encoding', 25 | 'client_encoding', 26 | 'is_superuser', 27 | 'session_authorization', 28 | 'DateStyle', 29 | 'TimeZone', 30 | 'IntervalStyle', 31 | 'integer_datetimes', 32 | 'application_name', 33 | 'standard_conforming_strings', 34 | ); 35 | 36 | private static $transactionStatus = array( 37 | PGSQL_TRANSACTION_IDLE => 'PGSQL_TRANSACTION_IDLE', 38 | PGSQL_TRANSACTION_ACTIVE => 'PGSQL_TRANSACTION_ACTIVE', 39 | PGSQL_TRANSACTION_INTRANS => 'PGSQL_TRANSACTION_INTRANS', 40 | PGSQL_TRANSACTION_INERROR => 'PGSQL_TRANSACTION_INERROR', 41 | PGSQL_TRANSACTION_UNKNOWN => 'PGSQL_TRANSACTION_UNKNOWN', 42 | ); 43 | 44 | private static $resultStatus = array( 45 | PGSQL_EMPTY_QUERY => 'PGSQL_EMPTY_QUERY', 46 | PGSQL_COMMAND_OK => 'PGSQL_COMMAND_OK', 47 | PGSQL_TUPLES_OK => 'PGSQL_TUPLES_OK', 48 | PGSQL_COPY_OUT => 'PGSQL_COPY_OUT', 49 | PGSQL_COPY_IN => 'PGSQL_COPY_IN', 50 | PGSQL_BAD_RESPONSE => 'PGSQL_BAD_RESPONSE', 51 | PGSQL_NONFATAL_ERROR => 'PGSQL_NONFATAL_ERROR', 52 | PGSQL_FATAL_ERROR => 'PGSQL_FATAL_ERROR', 53 | ); 54 | 55 | private static $diagCodes = array( 56 | 'severity' => PGSQL_DIAG_SEVERITY, 57 | 'sqlstate' => PGSQL_DIAG_SQLSTATE, 58 | 'message' => PGSQL_DIAG_MESSAGE_PRIMARY, 59 | 'detail' => PGSQL_DIAG_MESSAGE_DETAIL, 60 | 'hint' => PGSQL_DIAG_MESSAGE_HINT, 61 | 'statement position' => PGSQL_DIAG_STATEMENT_POSITION, 62 | 'internal position' => PGSQL_DIAG_INTERNAL_POSITION, 63 | 'internal query' => PGSQL_DIAG_INTERNAL_QUERY, 64 | 'context' => PGSQL_DIAG_CONTEXT, 65 | 'file' => PGSQL_DIAG_SOURCE_FILE, 66 | 'line' => PGSQL_DIAG_SOURCE_LINE, 67 | 'function' => PGSQL_DIAG_SOURCE_FUNCTION, 68 | ); 69 | 70 | public static function castLargeObject($lo, array $a, Stub $stub, $isNested) 71 | { 72 | $a['seek position'] = pg_lo_tell($lo); 73 | 74 | return $a; 75 | } 76 | 77 | public static function castLink($link, array $a, Stub $stub, $isNested) 78 | { 79 | $a['status'] = pg_connection_status($link); 80 | $a['status'] = new ConstStub(PGSQL_CONNECTION_OK === $a['status'] ? 'PGSQL_CONNECTION_OK' : 'PGSQL_CONNECTION_BAD', $a['status']); 81 | $a['busy'] = pg_connection_busy($link); 82 | 83 | $a['transaction'] = pg_transaction_status($link); 84 | if (isset(self::$transactionStatus[$a['transaction']])) { 85 | $a['transaction'] = new ConstStub(self::$transactionStatus[$a['transaction']], $a['transaction']); 86 | } 87 | 88 | $a['pid'] = pg_get_pid($link); 89 | $a['last error'] = pg_last_error($link); 90 | $a['last notice'] = pg_last_notice($link); 91 | $a['host'] = pg_host($link); 92 | $a['port'] = pg_port($link); 93 | $a['dbname'] = pg_dbname($link); 94 | $a['options'] = pg_options($link); 95 | $a['version'] = pg_version($link); 96 | 97 | foreach (self::$paramCodes as $v) { 98 | if (false !== $s = pg_parameter_status($link, $v)) { 99 | $a['param'][$v] = $s; 100 | } 101 | } 102 | 103 | $a['param']['client_encoding'] = pg_client_encoding($link); 104 | $a['param'] = new EnumStub($a['param']); 105 | 106 | return $a; 107 | } 108 | 109 | public static function castResult($result, array $a, Stub $stub, $isNested) 110 | { 111 | $a['num rows'] = pg_num_rows($result); 112 | $a['status'] = pg_result_status($result); 113 | if (isset(self::$resultStatus[$a['status']])) { 114 | $a['status'] = new ConstStub(self::$resultStatus[$a['status']], $a['status']); 115 | } 116 | $a['command-completion tag'] = pg_result_status($result, PGSQL_STATUS_STRING); 117 | 118 | if (-1 === $a['num rows']) { 119 | foreach (self::$diagCodes as $k => $v) { 120 | $a['error'][$k] = pg_result_error_field($result, $v); 121 | } 122 | } 123 | 124 | $a['affected rows'] = pg_affected_rows($result); 125 | $a['last OID'] = pg_last_oid($result); 126 | 127 | $fields = pg_num_fields($result); 128 | 129 | for ($i = 0; $i < $fields; ++$i) { 130 | $field = array( 131 | 'name' => pg_field_name($result, $i), 132 | 'table' => sprintf('%s (OID: %s)', pg_field_table($result, $i), pg_field_table($result, $i, true)), 133 | 'type' => sprintf('%s (OID: %s)', pg_field_type($result, $i), pg_field_type_oid($result, $i)), 134 | 'nullable' => (bool) pg_field_is_null($result, $i), 135 | 'storage' => pg_field_size($result, $i).' bytes', 136 | 'display' => pg_field_prtlen($result, $i).' chars', 137 | ); 138 | if (' (OID: )' === $field['table']) { 139 | $field['table'] = null; 140 | } 141 | if ('-1 bytes' === $field['storage']) { 142 | $field['storage'] = 'variable size'; 143 | } elseif ('1 bytes' === $field['storage']) { 144 | $field['storage'] = '1 byte'; 145 | } 146 | if ('1 chars' === $field['display']) { 147 | $field['display'] = '1 char'; 148 | } 149 | $a['fields'][] = new EnumStub($field); 150 | } 151 | 152 | return $a; 153 | } 154 | } 155 | -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 教务系统查询 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 |
17 |

成绩查询

18 |
19 |
20 |
21 |
22 | 请输入下列信息查询成绩信息 23 |
24 |
25 |
26 |
27 | 28 |
29 |
30 | 37 |
38 |
39 |
40 |
41 | 42 |
43 |
44 | 45 |
46 |
47 |
48 |
49 | 50 |
51 |
52 | 53 |
54 |
55 |
56 |
57 | 58 |
59 |
60 | 61 |
62 |
63 | 64 |
65 |
66 |
67 |
68 | 164 |
165 |
167 |
168 | 173 |
174 | 175 | 176 |
177 |
178 | 179 | 180 | -------------------------------------------------------------------------------- /code/training/Trait/CommonTrait.php: -------------------------------------------------------------------------------- 1 | getConfig('training'); 25 | $sampleDir = $trainingConf['studySampleGroup'][$groupName]; 26 | $sampleList = $this->getDirAllFile($sampleDir); 27 | 28 | //randomMessingArr 随机打乱数组 29 | $sampleList = $this->custom_shuffle($sampleList); 30 | 31 | return $sampleList; 32 | } 33 | 34 | /** 35 | * @param $groupName 36 | * @param null $area 37 | * @return array 38 | * @throws \Exception 39 | */ 40 | public function getTestSampleList($groupName, $area = null) 41 | { 42 | $trainingConf = $this->getConfig('training'); 43 | $sampleDir = $trainingConf['testSampleGroup'][$groupName]; 44 | $testSets = $this->getTestSet($sampleDir); 45 | 46 | if (empty($testSets)) { 47 | throw new \Exception('Test set is empty'); 48 | } 49 | 50 | if ($area == 'all') { 51 | foreach ($testSets as $testSet) { 52 | $testSetArr = $this->getDirAllFile($sampleDir . $testSet . '/'); 53 | $sampleList[$testSet] = $this->custom_shuffle($testSetArr); 54 | } 55 | return $sampleList; 56 | 57 | } elseif (is_string($area) || is_int($area)) { 58 | if (!in_array($area, $testSets)) { 59 | throw new \Exception('Invalid test set name passed in'); 60 | } 61 | $testSetArr = $this->getDirAllFile($sampleDir . $area . '/'); 62 | $sampleList[] = $this->custom_shuffle($testSetArr); 63 | return $sampleList; 64 | 65 | } elseif (is_array($area)) { 66 | foreach ($area as $testSet) { 67 | if (!in_array($area, $testSets)) { 68 | throw new \Exception('Invalid test set name passed in'); 69 | } 70 | $testSetArr = $this->getDirAllFile($sampleDir . $testSet . '/'); 71 | $sampleList[$testSet] = $this->custom_shuffle($testSetArr); 72 | } 73 | return $sampleList; 74 | 75 | } elseif ($area == null) { 76 | foreach ($testSets as $testSet) { 77 | $testSetArr = $this->getDirAllFile($sampleDir . $testSet . '/'); 78 | $sampleList[] = $this->custom_shuffle($testSetArr); 79 | return $sampleList; 80 | } 81 | } 82 | 83 | } 84 | 85 | /** 86 | * @param $dirPath 87 | * @return array 88 | */ 89 | public function getTestSet($dirPath) 90 | { 91 | $fileList = scandir($dirPath); 92 | array_splice($fileList, 0, 2); 93 | return $fileList; 94 | } 95 | 96 | /** 97 | * @param $dirPath 98 | * @param array $fileList 99 | * @return array 100 | */ 101 | public function getDirAllFile($dirPath) 102 | { 103 | $fileList = scandir($dirPath); 104 | $fileListTmp = []; 105 | array_splice($fileList, 0, 2); 106 | foreach ($fileList as $key => $fileName) { 107 | if (is_dir($dirPath . $fileName)) { 108 | unset($fileList[$key]); 109 | $fileListTmp_ = $this->getDirAllFile($dirPath . $fileName); 110 | $fileListTmp = array_merge($fileListTmp, $fileListTmp_); 111 | } else { 112 | $fileList[$key] = $dirPath . $fileName; 113 | } 114 | } 115 | $fileList = array_merge($fileList, $fileListTmp); 116 | return $fileList; 117 | } 118 | 119 | /** 120 | * @param array $myArray 121 | * @return array 122 | */ 123 | public function custom_shuffle($myArray = []) 124 | { 125 | $copy = []; 126 | while (count($myArray)) { 127 | $element = array_rand($myArray); 128 | $copy[$element] = $myArray[$element]; 129 | unset($myArray[$element]); 130 | } 131 | return $copy; 132 | } 133 | 134 | /** 135 | * @param $number 136 | * @return string 137 | */ 138 | public function getRandomHexStr($number) 139 | { 140 | $str = ''; 141 | for ($i = 0; $i < $number; ++$i) { 142 | $str .= dechex(rand(0, 15)); 143 | } 144 | return $str; 145 | } 146 | 147 | /** 148 | * @param $dictionaryName 149 | * @return array|mixed 150 | */ 151 | public function getDictionary($dictionaryName) 152 | { 153 | if (!is_file(__DIR__ . '/../../src/Dictionary/' . $dictionaryName)) { 154 | return []; 155 | } 156 | $dictionary = json_decode(file_get_contents(__DIR__ . '/../../src/Dictionary/' . $dictionaryName), true); 157 | return $dictionary; 158 | } 159 | 160 | /** 161 | * @param $char 162 | * @param $rowStr 163 | * @param IndexController $indexController 164 | */ 165 | public function addSampleToDictionary($char, $rowStr, IndexController $indexController) 166 | { 167 | $conf = $indexController->getConf(); 168 | $dictionaryName = $conf['componentGroup'][$conf['useGroup']]['dictionary']; 169 | $dictionary = $this->getDictionary($dictionaryName); 170 | 171 | $dictionary[] = [ 172 | 'char' => $char, 173 | 'rowStr' => $rowStr, 174 | ]; 175 | file_put_contents(__DIR__ . '/../../src/Dictionary/' . $dictionaryName, json_encode($dictionary)); 176 | } 177 | 178 | /** 179 | * @param IndexController $indexController 180 | * @return int 181 | */ 182 | public function getDictionarySampleCount(IndexController $indexController) 183 | { 184 | $conf = $indexController->getConf(); 185 | $dictionaryName = $conf['componentGroup'][$conf['useGroup']]['dictionary']; 186 | $dictionary = $this->getDictionary($dictionaryName); 187 | return count($dictionary); 188 | 189 | 190 | } 191 | 192 | 193 | } -------------------------------------------------------------------------------- /code/vendor/symfony/var-dumper/Tests/Caster/ReflectionCasterTest.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\VarDumper\Tests\Caster; 13 | 14 | use PHPUnit\Framework\TestCase; 15 | use Symfony\Component\VarDumper\Caster\Caster; 16 | use Symfony\Component\VarDumper\Test\VarDumperTestTrait; 17 | use Symfony\Component\VarDumper\Tests\Fixtures\GeneratorDemo; 18 | use Symfony\Component\VarDumper\Tests\Fixtures\NotLoadableClass; 19 | 20 | /** 21 | * @author Nicolas Grekas 22 | */ 23 | class ReflectionCasterTest extends TestCase 24 | { 25 | use VarDumperTestTrait; 26 | 27 | public function testReflectionCaster() 28 | { 29 | $var = new \ReflectionClass('ReflectionClass'); 30 | 31 | $this->assertDumpMatchesFormat( 32 | <<<'EOTXT' 33 | ReflectionClass { 34 | +name: "ReflectionClass" 35 | %Aimplements: array:%d [ 36 | 0 => "Reflector" 37 | %A] 38 | constants: array:3 [ 39 | "IS_IMPLICIT_ABSTRACT" => 16 40 | "IS_EXPLICIT_ABSTRACT" => 32 41 | "IS_FINAL" => %d 42 | ] 43 | properties: array:%d [ 44 | "name" => ReflectionProperty { 45 | %A +name: "name" 46 | +class: "ReflectionClass" 47 | %A modifiers: "public" 48 | } 49 | %A] 50 | methods: array:%d [ 51 | %A 52 | "export" => ReflectionMethod { 53 | +name: "export" 54 | +class: "ReflectionClass" 55 | %A parameters: { 56 | $%s: ReflectionParameter { 57 | %A position: 0 58 | %A 59 | } 60 | EOTXT 61 | , $var 62 | ); 63 | } 64 | 65 | public function testClosureCaster() 66 | { 67 | $a = $b = 123; 68 | $var = function ($x) use ($a, &$b) {}; 69 | 70 | $this->assertDumpMatchesFormat( 71 | <<assertDumpEquals($expectedDump, $var, Caster::EXCLUDE_VERBOSE); 100 | } 101 | 102 | public function testReflectionParameter() 103 | { 104 | $var = new \ReflectionParameter(__NAMESPACE__.'\reflectionParameterFixture', 0); 105 | 106 | $this->assertDumpMatchesFormat( 107 | <<<'EOTXT' 108 | ReflectionParameter { 109 | +name: "arg1" 110 | position: 0 111 | typeHint: "Symfony\Component\VarDumper\Tests\Fixtures\NotLoadableClass" 112 | default: null 113 | } 114 | EOTXT 115 | , $var 116 | ); 117 | } 118 | 119 | /** 120 | * @requires PHP 7.0 121 | */ 122 | public function testReflectionParameterScalar() 123 | { 124 | $f = eval('return function (int $a) {};'); 125 | $var = new \ReflectionParameter($f, 0); 126 | 127 | $this->assertDumpMatchesFormat( 128 | <<<'EOTXT' 129 | ReflectionParameter { 130 | +name: "a" 131 | position: 0 132 | typeHint: "int" 133 | } 134 | EOTXT 135 | , $var 136 | ); 137 | } 138 | 139 | /** 140 | * @requires PHP 7.0 141 | */ 142 | public function testReturnType() 143 | { 144 | $f = eval('return function ():int {};'); 145 | $line = __LINE__ - 1; 146 | 147 | $this->assertDumpMatchesFormat( 148 | <<markTestSkipped('xdebug is active'); 168 | } 169 | 170 | $generator = new GeneratorDemo(); 171 | $generator = $generator->baz(); 172 | 173 | $expectedDump = <<<'EODUMP' 174 | Generator { 175 | this: Symfony\Component\VarDumper\Tests\Fixtures\GeneratorDemo { …} 176 | executing: { 177 | Symfony\Component\VarDumper\Tests\Fixtures\GeneratorDemo->baz() { 178 | %sGeneratorDemo.php:14 { 179 | › { 180 | › yield from bar(); 181 | › } 182 | } 183 | } 184 | } 185 | closed: false 186 | } 187 | EODUMP; 188 | 189 | $this->assertDumpMatchesFormat($expectedDump, $generator); 190 | 191 | foreach ($generator as $v) { 192 | break; 193 | } 194 | 195 | $expectedDump = <<<'EODUMP' 196 | array:2 [ 197 | 0 => ReflectionGenerator { 198 | this: Symfony\Component\VarDumper\Tests\Fixtures\GeneratorDemo { …} 199 | trace: { 200 | %s%eTests%eFixtures%eGeneratorDemo.php:9 { 201 | › { 202 | › yield 1; 203 | › } 204 | } 205 | %s%eTests%eFixtures%eGeneratorDemo.php:20 { …} 206 | %s%eTests%eFixtures%eGeneratorDemo.php:14 { …} 207 | } 208 | closed: false 209 | } 210 | 1 => Generator { 211 | executing: { 212 | Symfony\Component\VarDumper\Tests\Fixtures\GeneratorDemo::foo() { 213 | %sGeneratorDemo.php:10 { 214 | › yield 1; 215 | › } 216 | › 217 | } 218 | } 219 | } 220 | closed: false 221 | } 222 | ] 223 | EODUMP; 224 | 225 | $r = new \ReflectionGenerator($generator); 226 | $this->assertDumpMatchesFormat($expectedDump, array($r, $r->getExecutingGenerator())); 227 | 228 | foreach ($generator as $v) { 229 | } 230 | 231 | $expectedDump = <<<'EODUMP' 232 | Generator { 233 | closed: true 234 | } 235 | EODUMP; 236 | $this->assertDumpMatchesFormat($expectedDump, $generator); 237 | } 238 | } 239 | 240 | function reflectionParameterFixture(NotLoadableClass $arg1 = null, $arg2) 241 | { 242 | } 243 | --------------------------------------------------------------------------------