├── 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 |
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 |
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 |
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 | 
35 | 
36 | 
37 | 
38 | 
39 | 
40 | 
41 | 
42 | 
43 | 
44 | 
45 | 
46 | 
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 '
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 "
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
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 |
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 | <<
';
88 | }
89 | }
90 | 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 | 成绩查询
18 |
168 |
173 |