{"id":308661,"date":"2020-08-18T15:01:30","date_gmt":"2020-08-18T15:01:30","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=308661"},"modified":"-0001-11-30T00:00:00","modified_gmt":"2020-08-18T15:01:30","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=308661","title":{"rendered":"\u0421\u043e\u043a\u0440\u0430\u0449\u0430\u0435\u043c \u0441\u0441\u044b\u043b\u043a\u0438 \u0431\u0435\u0437 \u0436\u0438\u0440\u0430 (F3)"},"content":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/515636\/\">\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/xn\/67\/jz\/xn67jzqjb8k4jfeeje-stzezwi0.png\"><\/p>\n<p>  <\/p>\n<p>\u0421\u043e\u043a\u0440\u0430\u0449\u0430\u0442\u044c \u0441\u0441\u044b\u043b\u043a\u0438 \u0432 13 \u043b\u0435\u0442 \u043d\u0435 \u0441\u0442\u044b\u0434\u043d\u043e, \u0432\u0435\u0440\u043d\u043e?<br \/>  \u041d\u043e\u0432\u0438\u0447\u043a\u0443, \u0434\u0430 \u0438 \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u043e\u0432\u0438\u0447\u043a\u0443, \u0441\u0442\u043e\u0438\u0442 \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0432\u043e\u0439 \u0423\u043a\u0440\u043e\u0442\u0438\u0442\u0435\u043b\u044c \u0421\u0441\u044b\u043b\u043e\u043a, \u043f\u043e\u0445\u043e\u0434\u0443 \u0438\u0437\u0443\u0447\u0430\u044f \u043a\u0430\u043a\u043e\u0439-\u043d\u0438\u0431\u0443\u0434\u044c \u043d\u043e\u0432\u044b\u0439 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a. \u0427\u0435\u043c \u044f \u0438 \u0437\u0430\u043d\u044f\u043b\u0441\u044f. \u0427\u0442\u043e \u0441\u043a\u0430\u0437\u0430\u0442\u044c \u2014 \u043f\u044f\u0442\u044b\u0439 \u0431\u0443\u0442\u0441\u0442\u0440\u0430\u043f, \u043e\u0431\u0435\u0437\u0436\u0438\u0440\u0435\u043d\u043d\u044b\u0439 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a \u0438 \u0447\u0430\u0441\u0442\u0438\u0447\u043a\u0430 \u0434\u0443\u0448\u0438. <\/p>\n<p><a name=\"habracut\"><\/a>  <\/p>\n<p>\u0412\u043e\u0442 <a href=\"https:\/\/a.nikonovs.ru\" rel=\"nofollow\">\u0434\u0435\u043c\u043e<\/a>, \u0430 \u0432\u043e\u0442 <a href=\"https:\/\/a.nikonovs.ru\/FXYZ\" rel=\"nofollow\">\u043a\u043e\u0434<\/a>. \u0414\u043b\u044f \u0442\u0430\u043a\u0438\u0445 \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u0435\u0439, \u043a\u0430\u043a \u044f \ud83d\ude09<\/p>\n<p>  <\/p>\n<h2 id=\"freymvork-ne-tak-li\">\u0424\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a, \u043d\u0435 \u0442\u0430\u043a \u043b\u0438?<\/h2>\n<p>  <\/p>\n<p>\u041a\u043e\u043d\u0435\u0447\u043d\u043e \u043d\u0435 Laravel \u0438 \u0442\u043e\u043c\u0443 \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0435 \u2014 \u0441\u0435\u0433\u043e\u0434\u043d\u044f \u043e\u0431\u043e\u0439\u0434\u0451\u043c\u0441\u044f 65-\u044e \u043a\u0438\u043b\u043e\u0431\u0430\u0439\u0442\u0430\u043c\u0438 <a href=\"https:\/\/fatfreeframework.com\/\" rel=\"nofollow\">FatFreeFramework<\/a>. \u0415\u0441\u043b\u0438 \u0412\u044b \u0437\u043d\u0430\u043a\u043e\u043c\u044b \u0441 Python Flask, \u0442\u043e \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u0435\u0442 \u043e\u0449\u0443\u0449\u0435\u043d\u0438\u0435, \u0447\u0442\u043e \u0433\u0434\u0435-\u0442\u043e \u044d\u0442\u043e \u0443\u0436\u0435 \u0431\u044b\u043b\u043e:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">#\u0440\u043e\u0443\u0442\u0438\u043d\u0433 \u0432\u043e \u0424\u043b\u0430\u0441\u043a\u0435 @app.route('\/') def hello_world():     return 'Hello, World!' <\/code><\/pre>\n<p>  <\/p>\n<hr>\n<p>  <\/p>\n<pre><code class=\"php\">\/\/\u0440\u043e\u0443\u0442\u0438\u043d\u0433 \u0432 \u041e\u0431\u0435\u0437\u0436\u0438\u0440\u0435\u043d\u043d\u043e\u043c $f3-&gt;route('GET \/',     function() {         echo 'Hello, world!';     } );<\/code><\/pre>\n<p>  <\/p>\n<p>\u041b\u0430\u0434\u043d\u043e, \u0437\u0430\u0431\u0443\u0434\u044c\u0442\u0435. \u0421\u043a\u0430\u0447\u0438\u0432\u0430\u0435\u043c <a href=\"https:\/\/a.nikonovs.ru\/F8JS\" rel=\"nofollow\">.zip \u0441 \u043e\u0444\u0444.\u0441\u0430\u0439\u0442\u0430<\/a>, \u0440\u0430\u0441\u043f\u0430\u043a\u043e\u0432\u044b\u0432\u0430\u0435\u043c \u0432 \u043f\u0430\u043f\u043a\u0443, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0432 \u044d\u0442\u043e\u0442 \u0436\u0435 \u043c\u0438\u0433 \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0432 \u0432\u0430\u0448\u0435\u043c \u041b\u044e\u0431\u0438\u043c\u043e\u043c \u0420\u0435\u0434\u0430\u043a\u0442\u043e\u0440\u0435 \u041a\u043e\u0434\u0430. \u041e\u0447\u0438\u0441\u0442\u0438\u0442\u0435 <em>index.php<\/em> \u0438 \u0443\u0434\u0430\u043b\u0438\u0442\u0435 \u0432\u0441\u0435 \u0438\u0437 <em>\/ui.<\/em><\/p>\n<p>  <\/p>\n<p>\u0417\u0434\u0435\u0441\u044c \u0432\u0441\u0435 \u043f\u0440\u0435\u0434\u0435\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u2014 \u0432 \u043f\u0430\u043f\u043a\u0435 <em>ui<\/em> \u0443 \u043d\u0430\u0441 \u0432\u0441\u0435 \u0412\u044c\u044e\u0448\u043a\u0438, \u0430 \u0435\u0441\u043b\u0438 \u043f\u043e \u043f\u0440\u043e\u0441\u0442\u043e\u043c\u0443 \u2014 \u043f\u0440\u043e\u043a\u0430\u0447\u0430\u043d\u043d\u044b\u0435 \u0425\u0422\u041c\u041b \u0448\u0430\u0431\u043b\u043e\u043d\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e \u043f\u0440\u0438 \u0437\u0430\u0445\u043e\u0434\u0435 \u043d\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0439 URL.<\/p>\n<p>  <\/p>\n<p>\u0412\u043e\u0442 \u043a\u0430\u0440\u043a\u0430\u0441 \u043d\u0430\u0448\u0435\u0433\u043e &quot;\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f&quot;:<\/p>\n<p>  <\/p>\n<pre><code class=\"php\">&lt;?php \/\/\u0424\u0430\u0439\u043b: index.php  \/\/ Kickstart the framework $f3=require('lib\/base.php'); $f3-&gt;set('DEBUG', 1); if ((float)PCRE_VERSION&lt;8.0)     trigger_error('PCRE version is out of date'); $f3-&gt;config('config.ini');  \/\/\u0412\u0415\u0421\u042c \u041e\u0421\u0422\u0410\u041b\u042c\u041d\u041e\u0419 \u041a\u041e\u0414 \u0411\u0423\u0414\u0415\u041c \u041f\u0418\u0421\u0410\u0422\u042c \u0417\u0414\u0415\u0421\u042c  $f3-&gt;run();<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412\u043e\u0442 \u0438 \u0432\u0441\u0435, \u0447\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u0437\u043d\u0430\u0442\u044c \u0434\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430. \u041f\u0440\u0438\u0441\u0442\u0443\u043f\u0430\u0435\u043c \u043a \u043a\u043e\u0434\u0438\u043d\u0433\u0443! <\/p>\n<p>  <\/p>\n<p>[\u0434\u043b\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0439 <a href=\"https:\/\/a.nikonovs.ru\/5ANY\" rel=\"nofollow\">XAMPP<\/a> \u043d\u0430 Windows \u0438 VS Code, <a href=\"https:\/\/a.nikonovs.ru\/Y1K7\" rel=\"nofollow\">\u0441\u0442\u0430\u0442\u044c\u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0430 \u0432 \u041d\u043e\u0443\u0448\u0435\u043d\u0435<\/a>]<\/p>\n<p>  <\/p>\n<h2 id=\"homepage\">Homepage<\/h2>\n<p>  <\/p>\n<p>\u041d\u0430\u0447\u043d\u0435\u043c \u0441 \u0433\u043b\u0430\u0432\u043d\u043e\u0439 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b. \u041b\u043e\u0433\u0438\u0447\u043d\u043e, \u043f\u0440\u0430\u0432\u0434\u0430?<\/p>\n<p>  <\/p>\n<pre><code class=\"php\">\/\/\u0424\u0430\u0439\u043b: index.php  $f3-&gt;route('GET \/',     function($f3) { \/\/\u0447\u0442\u043e\u0431\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u0438 F3 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u043c \u0435\u0433\u043e \u0432 \u0440\u043e\u0443\u0442                 $view = new View; \/\/ \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u0432\u044c\u044e\u0448\u043a\u0443         echo $view-&gt;render('home.htm'); \/\/\u0440\u0435\u043d\u0434\u0435\u0440\u0438\u043c \u0448\u0430\u0431\u043b\u043e\u043d     } );<\/code><\/pre>\n<p>  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0443\u0436\u043d\u043e \u044d\u0442\u043e\u0442 \u0441\u0430\u043c\u044b\u0439 \u0448\u0430\u0431\u043b\u043e\u043d \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c. \u0414\u043b\u044f \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u044b \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b <a href=\"https:\/\/a.nikonovs.ru\/IJP4\" rel=\"nofollow\">\u0431\u0443\u0442\u0441\u0442\u0440\u0430\u043f v5 alpfa.<\/a><\/p>\n<p>  <\/p>\n<p>\u041d\u0435 \u0437\u0430\u0431\u0443\u0434\u044c\u0442\u0435 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0432\u0441\u0435 \u0448\u0430\u0431\u043b\u043e\u043d\u044b \u0432 \u043f\u0430\u043f\u043a\u0435 <em>ui,<\/em> \u0438\u043d\u0430\u0447\u0435 \u043e\u043d\u0438 <strong>\u043d\u0435 \u0431\u0443\u0434\u0443\u0442<\/strong> \u0432\u0438\u0434\u043d\u044b \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0443<\/p>\n<p>  <\/p>\n<pre><code class=\"php\">&lt;!-- \u0424\u0430\u0439\u043b: ui\/home.htm --&gt;  &lt;!DOCTYPE html&gt; &lt;html lang=&quot;en&quot;&gt;     &lt;head&gt;         &lt;meta charset=&quot;&lt;?php echo $ENCODING; ?&gt;&quot; \/&gt;         &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1&quot;&gt;         &lt;title&gt;\u041f\u0438\u0448\u0435\u043c (\u043a\u043e\u0434), \u0441\u043e\u043a\u0440\u0430\u0449\u0430\u0435\u043c (\u0441\u0441\u044b\u043b\u043a\u0438)!&lt;\/title&gt;         &lt;link rel=&quot;stylesheet&quot; href=&quot;https:\/\/stackpath.bootstrapcdn.com\/bootstrap\/5.0.0-alpha1\/css\/bootstrap.min.css&quot; integrity=&quot;sha384-r4NyP46KrjDleawBgD5tp8Y7UzmLA05oM1iAEQ17CSuDqnUK2+k9luXQOfXJCJ4I&quot; crossorigin=&quot;anonymous&quot;&gt;     &lt;\/head&gt;     &lt;body class=&quot;text-center bg-dark text-light&quot;&gt; &lt;!-- \u0442\u0435\u043c\u043d\u0430\u044f \u0442\u0435\u043c\u0430 ;) --&gt;          &lt;!-- \u043c\u0435\u043d\u044e\u0448\u043a\u0430 --&gt;         &lt;nav class=&quot;m-2&quot;&gt;             &lt;ul class=&quot;nav nav-pills justify-content-center&quot;&gt;                 &lt;li class=&quot;nav-item&quot;&gt;                     &lt;a class=&quot;nav-link active&quot; aria-current=&quot;page&quot; href=&quot;#&quot;&gt;\u0413\u043b\u0430\u0432\u043d\u0430\u044f&lt;\/a&gt;                 &lt;\/li&gt;                 &lt;li class=&quot;nav-item&quot;&gt;                     &lt;a class=&quot;nav-link&quot; href=&quot;#&quot;&gt;\u0421\u0442\u0430\u0442\u044c\u044f \u043d\u0430 \u0425\u0430\u0431\u0440\u0435&lt;\/a&gt;                 &lt;\/li&gt;                 &lt;li class=&quot;nav-item&quot;&gt;                     &lt;a class=&quot;nav-link&quot; href=&quot;https:\/\/nikonovs.ru&quot;&gt;\u0421\u043e\u0437\u0434\u0430\u0442\u0435\u043b\u044c&lt;\/a&gt;                 &lt;\/li&gt;             &lt;\/ul&gt;         &lt;\/nav&gt;          &lt;div class=&quot;container&quot;&gt;         &lt;h1&gt;\u041a\u043e\u0440\u043e\u0442\u043a\u0438\u0435 \u0441\u0441\u044b\u043b\u043a\u0438 \u0443\u0436\u0435 \u0437\u0434\u0435\u0441\u044c.&lt;\/h1&gt;          &lt;!-- \u0411\u0443\u0434\u0435\u043c \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 POST-\u0437\u0430\u043f\u0440\u043e\u0441\u043e\u043c \u043d\u0430 \/newLink --&gt;         &lt;form class=&quot;mt-5 mb-3&quot; action=&quot;\/newLink\/&quot; method=&quot;POST&quot;&gt;             &lt;div class=&quot;row justify-content-center&quot;&gt;                 &lt;div class=&quot;col-auto&quot;&gt;                 &lt;label for=&quot;inputLink&quot; class=&quot;col-form-label&quot;&gt;\u0412\u0432\u0435\u0434\u0438 \u0441\u0441\u044b\u043b\u043a\u0443:&lt;\/label&gt;                 &lt;\/div&gt;                 &lt;div class=&quot;col-auto&quot;&gt;                 &lt;input required placeholder=&quot;https:\/\/&quot; type=&quot;url&quot; name=&quot;link&quot; id=&quot;inputLink&quot; class=&quot;form-control mb-1&quot; aria-describedby=&quot;inputLink&quot;&gt;                 &lt;\/div&gt;                 &lt;div class=&quot;col-auto&quot;&gt;                 &lt;button type=&quot;submit&quot; class=&quot;btn btn-outline-primary&quot;&gt;\u0421\u043e\u043a\u0440\u0430\u0442\u0438\u0442\u044c!&lt;\/button&gt;                 &lt;\/div&gt;             &lt;\/div&gt;         &lt;\/form&gt;          &lt;!-- \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0442\u0435\u043a\u0441\u0442\u0430 \u0441 \u041a\u043b\u0438\u043a\u0435\u0440\u0430 --&gt;         &lt;p class=&quot;text-left m-auto mb-5&quot; style=&quot;max-width: 30rem;&quot;&gt;\u0414\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0447\u0430\u0441\u0442\u043e \u043f\u0440\u0438 \u043e\u0431\u0449\u0435\u043d\u0438\u0438 \u0432 \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442\u0435 \u043b\u044e\u0434\u0438 \u043f\u0435\u0440\u0435\u0441\u044b\u043b\u0430\u044e\u0442 \u0434\u0440\u0443\u0433 \u0434\u0440\u0443\u0433\u0443 \u0441\u0441\u044b\u043b\u043a\u0438. \u0418\u043d\u043e\u0433\u0434\u0430 \u044d\u0442\u0438 \u0441\u0441\u044b\u043b\u043a\u0438 \u0431\u044b\u0432\u0430\u044e\u0442 \u0434\u043b\u0438\u043d\u043d\u044b\u043c\u0438. \u0421\u043e\u0432\u0441\u0435\u043c \u0438\u043d\u043e\u0433\u0434\u0430 \u2014 \u043e\u0447\u0435\u043d\u044c \u0434\u043b\u0438\u043d\u043d\u044b\u043c\u0438. \u041d\u043e \u043f\u043e\u0447\u0442\u0438 \u0432\u0441\u0435\u0433\u0434\u0430 \u2014 \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u0434\u043b\u0438\u043d\u043d\u044b\u043c\u0438. \u0414\u043b\u044f \u0442\u043e\u0433\u043e \u0447\u0442\u043e\u0431\u044b \u0438\u0437\u0431\u0430\u0432\u0438\u0442\u044c\u0441\u044f \u043e\u0442 \u044d\u0442\u043e\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b, \u0431\u044b\u043b \u0441\u043e\u0437\u0434\u0430\u043d \u044d\u0442\u043e\u0442 \u0441\u0430\u0439\u0442. \u0414\u0430, \u044f \u0437\u043d\u0430\u044e, \u0447\u0442\u043e \u0442\u0430\u043a\u0438\u0445 \u0442\u044b\u0441\u044f\u0447\u0438, \u043d\u043e \u044d\u0442\u043e\u0442 \u0436\u0435 \u043b\u0443\u0447\u0448\u0435!             \u0410 \u0434\u0430\u043b\u044c\u0448\u0435 \u0432\u0441\u0435 \u043f\u0440\u043e\u0441\u0442\u043e: \u0432\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442\u0435 \u0441\u0441\u044b\u043b\u043a\u0443 \u0432 \u043f\u043e\u043b\u0435 \u0434\u043b\u044f \u0432\u0432\u043e\u0434\u0430, \u043d\u0430\u0436\u0438\u043c\u0430\u0435\u0442\u0435 &quot;\u0421\u043e\u043a\u0440\u0430\u0442\u0438\u0442\u044c!&quot; \u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0435 \u043a\u043e\u0440\u043e\u0442\u043a\u0438\u0439, \u0441\u043e\u0432\u0441\u0435\u043c \u043a\u043e\u0440\u043e\u0442\u043a\u0438\u0439 URL. &amp;copy; &lt;a href=&quot;https:\/\/clck.ru&quot;&gt;\u041a\u043b\u0438\u043a\u0435\u0440&lt;\/a&gt;&lt;\/p&gt;          &lt;footer class=&quot;m-2&quot;&gt;\u0421\u0434\u0435\u043b\u0430\u043d\u043e \u0441 &lt;img width=&quot;20&quot; height=&quot;20&quot; src=&quot;https:\/\/image.flaticon.com\/icons\/svg\/833\/833472.svg&quot; alt=&quot;\u043b\u044e\u0431\u043e\u0432\u044c\u044e&quot;&gt;, &lt;a href=&quot;https:\/\/v5.getbootstrap.com\/&quot;&gt;\u043f\u044f\u0442\u044b\u043c Bootstrap'\u043e\u043c&lt;\/a&gt;    \u0438 &lt;a href=&quot;https:\/\/fatfreeframework.com\/&quot;&gt;\u0431\u0435\u0437 \u0436\u0438\u0440\u0430&lt;\/a&gt;&lt;\/footer&gt;         &lt;\/div&gt;     &lt;\/body&gt; &lt;\/html&gt;<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412\u043e\u0442 \u0438 \u0432\u0441\u0435, \u0443 \u043d\u0430\u0441 \u0443\u0436\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0433\u043b\u0430\u0432\u043d\u0430\u044f \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430. \u0424\u043e\u0440\u043c\u0430 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 POST-\u0437\u0430\u043f\u0440\u043e\u0441\u043e\u043c \u0441\u0441\u044b\u043b\u043a\u0443, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u043a\u0440\u0430\u0442\u0438\u0442\u044c.<br \/>  \u0422\u0435\u043f\u0435\u0440\u044c \u0441\u0430\u043c\u043e\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0435 (\u043d\u0435\u0442).<\/p>\n<p>  <\/p>\n<h2 id=\"rabota-s-bd\">\u0420\u0430\u0431\u043e\u0442\u0430 \u0441 \u0411\u0414<\/h2>\n<p>  <\/p>\n<p>\u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0411\u0414 \u2014 MySQL. \u0415\u0441\u043b\u0438 \u0443 \u0412\u0430\u0441 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d PhpMyAdmin, \u0442\u043e \u0441\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u043d\u043e\u0432\u0443\u044e \u0411\u0414 &quot;<em>linker<\/em>&quot;, \u0430 \u043f\u043e\u0442\u043e\u043c \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0435 \u044d\u0442\u043e\u0442 SQL:<\/p>\n<p>  <\/p>\n<pre><code class=\"sql\">SET SQL_MODE = &quot;NO_AUTO_VALUE_ON_ZERO&quot;; SET time_zone = &quot;+00:00&quot;;  CREATE TABLE IF NOT EXISTS `links` (   `code` varchar(4) NOT NULL,   `link` varchar(1000) NOT NULL,   `hits` int(255) NOT NULL DEFAULT '0' ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;  ALTER TABLE `links`   ADD UNIQUE KEY `code` (`code`);<\/code><\/pre>\n<p>  <\/p>\n<p>\u0423 \u043d\u0430\u0441 \u0431\u0443\u0434\u0435\u0442 3 \u043f\u043e\u043b\u044f \u0443 \u043a\u0430\u0436\u0434\u043e\u0439 \u0441\u0441\u044b\u043b\u043a\u0438:<\/p>\n<p>  <\/p>\n<ol>\n<li>Code \u2014 \u044d\u0442\u043e \u0440\u0430\u043d\u0434\u043e\u043c\u043d\u044b\u0435 4 \u0441\u0438\u043c\u0432\u043e\u043b\u0430 \u043f\u043e\u0441\u043b\u0435 \u0434\u043e\u043c\u0435\u043d\u0430, \u043f\u043e \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442\u044c \u043f\u0435\u0440\u0435\u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435, \u0432\u0438\u0434\u0430 <em>example.com\/ABC1<\/em><\/li>\n<li>Link \u2014 <em>\u041d\u0435 \u0441\u043e\u043a\u0440\u0430\u0449\u0435\u043d\u043d\u0430\u044f<\/em> \u0441\u0441\u044b\u043b\u043a\u0430.<\/li>\n<li>Hits \u2014 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u043e\u0432 \u043f\u043e \u0441\u043e\u043a\u0440\u0430\u0449\u0435\u043d\u043d\u043e\u0439 \u0441\u0441\u044b\u043b\u043a\u0435.<\/li>\n<\/ol>\n<p>  <\/p>\n<p>\u041a\u0440\u0430\u0442\u043a\u043e \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u043f\u0440\u0438\u043d\u0446\u0438\u043f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0411\u0414, \u0431\u0435\u0437 \u0436\u0438\u0440\u0430.<\/p>\n<p>  <\/p>\n<pre><code class=\"php\">&lt;?php \/\/\u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c\u0441\u044f \u043a \u0411\u0414 $db = new DB\\SQL(     'mysql:host=localhost;port=3306;dbname=linker',     'root',     '' );  \/\/\u0414\u0430\u043b\u044c\u0448\u0435 \u0435\u0441\u0442\u044c \u0434\u0432\u0430 \u0432\u0430\u0440\u0438\u0430\u043d\u0434\u0430 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438:  \/\/\u041c\u043e\u0436\u043d\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u0432 \u0424\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a c \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043e\u0431\u044b\u0447\u043d\u043e\u0433\u043e SQL-\u0437\u0430\u043f\u0440\u043e\u0441\u0430: $f3-&gt;set('result', $db-&gt;exec('SELECT * FROM wherever'));  \/\/\u043e\u043d\u0438 \u0431\u0443\u0434\u0443\u0442 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b \u0432 \u0448\u0430\u0431\u043b\u043e\u043d\u0430\u0445, \u043a\u0430\u043a &lt;?= $resul ? &gt;  \/\/\u0410 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0439 SQL Mapper: $row = new DB\\SQL\\Mapper($db, 'links');  $row-&gt;load(array('link=&quot;https:\/\/habrahabr.ru&quot;')); \/\/\u0442\u0435\u043f\u0435\u0440\u044c \u0438\u0437 \u044d\u0442\u043e\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b \u0432\u0441\u0435 \u043a\u043e\u043b\u043e\u043d\u043a\u0438 \u0441\u0442\u0440\u043e\u043a\u0438, \u0433\u0434\u0435 \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u0425\u0430\u0431\u0440: $row_value = $row-&gt;somerow; \/\/\u0412\u043e\u0442 \u0442\u0430\u043a  \/\/ \u0415\u0441\u0442\u0435\u0441\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043c\u043e\u0436\u043d\u043e \u0438\u0437\u043c\u0435\u043d\u044f\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f: $row-&gt;link = 'https:\/\/habr.com'; $row-&gt;save(); \/\/\u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c, \u0430 \u0447\u0442\u043e \u0432\u044b \u0434\u0443\u043c\u0430\u043b\u0438  \/\/ \u0431\u043e\u043b\u044c\u0448\u0435 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043f\u043e \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u0411\u0414 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e \u0437\u0434\u0435\u0441\u044c: https:\/\/a.nikonovs.ru\/MPHR \u041d\u0430\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c, \u0445\u043e\u0442\u044f\u0431\u044b \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0447\u0438\u043a\u0430, \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u043e\u0433\u043e \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440. ?&gt;<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u0440\u0438\u0441\u0442\u0443\u043f\u0430\u0435\u043c \u043a \u0423\u043a\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u043d\u0438\u044e.<\/p>\n<p>  <\/p>\n<h2 id=\"obrabotka-novoy-ssylki\">\u041e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u043d\u043e\u0432\u043e\u0439 \u0441\u0441\u044b\u043b\u043a\u0438<\/h2>\n<p>  <\/p>\n<p>\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043d\u043e\u0432\u0443\u044e \u0412\u044c\u044e\u0448\u043a\u0443 \u0432 <em>index&#8217;e<\/em>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441 \u0438\u0437 \u0444\u043e\u0440\u043c\u044b \u043d\u0430 \u0433\u043b\u0430\u0432\u043d\u043e\u0439 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435.<\/p>\n<p>  <\/p>\n<p>\u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043d\u043e\u0432\u044b\u0439, \u043d\u043e \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u0445\u043e\u0436\u0438\u0439 \u043d\u0430 \u043f\u0435\u0440\u0432\u044b\u0439 (home.htm) \u0448\u0430\u0431\u043b\u043e\u043d \u2014 &quot;<em>newLink.htm<\/em>&quot;.<br \/>  \u0422\u0430\u043c \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u044c \u0443\u0436\u0435 \u0441\u043e\u043a\u0440\u0430\u0449\u0435\u043d\u043d\u0443\u044e \u0441\u0441\u044b\u043b\u043a\u0443 \u0438 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u043e\u0432 \u043f\u043e \u043d\u0435\u0439 (\u0447\u0442\u043e\u0431\u044b \u0441\u043d\u043e\u0432\u0430 \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u044d\u0442\u0443 &quot;\u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0443&quot; \u043d\u0443\u0436\u043d\u043e \u0441\u043d\u043e\u0432\u0430 \u0441\u043e\u043a\u0440\u0430\u0442\u0438\u0442\u044c \u044d\u0442\u0443 \u0436\u0435 \u0441\u0441\u044b\u043b\u043a\u0443 \u2014 \u0430\u0434\u0440\u0435\u0441 \u043e\u0441\u0442\u0430\u043d\u0435\u0442\u0441\u044f \u0442\u043e\u0442 \u0436\u0435).<br \/>  \u0414\u043b\u044f \u0432\u044b\u0432\u043e\u0434\u0430 \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u0442\u0440\u044e\u043a\u043e\u043c \u0441 &quot;\u043f\u0435\u0440\u0435\u0445\u043e\u0434\u043e\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445&quot;:<\/p>\n<p>  <\/p>\n<pre><code class=\"php\">&lt;?php \/\/\u0424\u0430\u0439\u043b: \u043d\u0435\u0442 (\u043f\u0440\u0438\u043c\u0435\u0440)  \/\/\u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u0432 index'\u0435 \u0438 \u0440\u0435\u043d\u0434\u0435\u0440\u0438\u043c \u0448\u0430\u0431\u043b\u043e\u043d $f3-&gt;set('link', $shorted_link); $view = new View; echo $view-&gt;render('newLink.htm'); \/\/\u0442\u0435\u043f\u0435\u0440\u044c \u0432 \u0448\u0430\u0431\u043b\u043e\u043d\u0435 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c: &lt;?= $link ?&gt;<\/code><\/pre>\n<p>  <\/p>\n<p>\u0410 \u0432\u043e\u0442 \u0438 \u043b\u0438\u0441\u0442\u0438\u043d\u0433 <em>newLink.html:<\/em><\/p>\n<p>  <\/p>\n<pre><code class=\"php\">&lt;!-- \u0424\u0430\u0439\u043b: newLink.htm --&gt;  &lt;!DOCTYPE html&gt; &lt;html lang=&quot;en&quot;&gt;     &lt;head&gt;         &lt;meta charset=&quot;&lt;?php echo $ENCODING; ?&gt;&quot; \/&gt;         &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1&quot;&gt;         &lt;title&gt;\u041f\u0438\u0448\u0435\u043c (\u043a\u043e\u0434), \u0441\u043e\u043a\u0440\u0430\u0449\u0430\u0435\u043c (\u0441\u0441\u044b\u043b\u043a\u0438)!&lt;\/title&gt;         &lt;link rel=&quot;stylesheet&quot; href=&quot;https:\/\/stackpath.bootstrapcdn.com\/bootstrap\/5.0.0-alpha1\/css\/bootstrap.min.css&quot; integrity=&quot;sha384-r4NyP46KrjDleawBgD5tp8Y7UzmLA05oM1iAEQ17CSuDqnUK2+k9luXQOfXJCJ4I&quot; crossorigin=&quot;anonymous&quot;&gt;     &lt;\/head&gt;     &lt;body class=&quot;text-center bg-dark text-light&quot;&gt;         &lt;nav class=&quot;m-2&quot;&gt;             &lt;ul class=&quot;nav nav-pills justify-content-center&quot;&gt;                 &lt;li class=&quot;nav-item&quot;&gt;                     &lt;a class=&quot;nav-link&quot; aria-current=&quot;page&quot; href=&quot;\/&quot;&gt;\u0413\u043b\u0430\u0432\u043d\u0430\u044f&lt;\/a&gt;                 &lt;\/li&gt;                 &lt;li class=&quot;nav-item&quot;&gt;                     &lt;a class=&quot;nav-link&quot; href=&quot;#&quot;&gt;\u0421\u0442\u0430\u0442\u044c\u044f \u043d\u0430 \u0425\u0430\u0431\u0440\u0435&lt;\/a&gt;                 &lt;\/li&gt;                 &lt;li class=&quot;nav-item&quot;&gt;                     &lt;a class=&quot;nav-link&quot; href=&quot;https:\/\/nikonovs.ru&quot;&gt;\u0421\u043e\u0437\u0434\u0430\u0442\u0435\u043b\u044c&lt;\/a&gt;                 &lt;\/li&gt;             &lt;\/ul&gt;         &lt;\/nav&gt;          &lt;div class=&quot;container&quot;&gt;         &lt;h1&gt;\u041a\u043e\u0440\u043e\u0442\u043a\u0438\u0435 \u0441\u0441\u044b\u043b\u043a\u0438 \u0443\u0436\u0435 \u0437\u0434\u0435\u0441\u044c.&lt;\/h1&gt;          &lt;!-- \u0423\u0431\u0438\u0440\u0430\u0435\u043c \u0438\u0437 \u0444\u043e\u0440\u043c\u044b \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b \u0444\u043e\u0440\u043c\u044b \u0438 \u0432\u044b\u0432\u043e\u0434\u0438\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 --&gt;         &lt;form class=&quot;mt-5 mb-3&quot;&gt;             &lt;div class=&quot;row justify-content-center&quot;&gt;                 &lt;div class=&quot;col-auto&quot;&gt;                     &lt;label for=&quot;inputLink&quot; class=&quot;col-form-label&quot;&gt;\u0421\u043e\u043a\u0440\u0430\u0442\u0438\u043b\u0438:&lt;\/label&gt;                 &lt;\/div&gt;                 &lt;div class=&quot;col-auto&quot;&gt;                     &lt;input disabled required type=&quot;url&quot; name=&quot;link&quot; id=&quot;inputLink&quot; class=&quot;form-control disabled&quot; aria-describedby=&quot;inputLink&quot; value=&quot;&lt;?= $link ?&gt;&quot;&gt;                 &lt;\/div&gt;             &lt;\/div&gt;             &lt;p class=&quot;m-2 text-secondary&quot;&gt;\u041f\u043e \u044d\u0442\u043e\u0439 \u0441\u0441\u044b\u043b\u043a\u0435 \u043f\u0435\u0440\u0435\u0448\u043b\u0438: `&lt;?= $hits ?&gt;`&lt;\/p&gt;         &lt;\/form&gt;          &lt;a href=&quot;\/&quot; class=&quot;mt-3 mb-5 btn btn-primary btn-lg&quot;&gt;\u0412\u0415\u0420\u041d\u0423\u0422\u042c\u0421\u042f \u041d\u0410 \u0413\u041b\u0410\u0412\u041d\u0423\u042e&lt;\/a&gt;          &lt;footer class=&quot;m-2&quot;&gt;\u0421\u0434\u0435\u043b\u0430\u043d\u043e \u0441 &lt;img width=&quot;20&quot; height=&quot;20&quot; src=&quot;https:\/\/image.flaticon.com\/icons\/svg\/833\/833472.svg&quot; alt=&quot;\u043b\u044e\u0431\u043e\u0432\u044c\u044e&quot;&gt;, &lt;a href=&quot;https:\/\/v5.getbootstrap.com\/&quot;&gt;\u043f\u044f\u0442\u044b\u043c Bootstrap'\u043e\u043c&lt;\/a&gt;    \u0438 &lt;a href=&quot;https:\/\/fatfreeframework.com\/&quot;&gt;\u0431\u0435\u0437 \u0436\u0438\u0440\u0430&lt;\/a&gt;&lt;\/footer&gt;         &lt;\/div&gt;     &lt;\/body&gt; &lt;\/html&gt;<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u0438\u0448\u0435\u043c \u0441\u0430\u043c \u0440\u043e\u0443\u0442.<\/p>\n<p>  <\/p>\n<pre><code class=\"php\">$f3-&gt;route('GET|POST \/newLink', \/\/\u043c\u044b \u0431\u0443\u0434\u0435\u043c \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0438 POST \u0438 GET     function($f3) {              $db = new DB\\SQL( \/\/\u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043a \u0411\u0414 \u043d\u043e\u0432\u043e\u0435 \u0432 \u043a\u0430\u0436\u0434\u043e\u043c \u0420\u043e\u0443\u0442\u0435                 'mysql:host=localhost;port=3306;dbname=linker',                 'root',                 ''             );              \/\/\u043f\u0440\u0435\u043a\u0440\u0430\u0441\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u0440\u0430\u0434\u043e\u043c\u043d\u044b\u0445 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432:             $permitted_chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ';             function generate_string($input, $strength = 4) {                 $input_length = strlen($input);                 $random_string = '';                 for($i = 0; $i &lt; $strength; $i++) {                     $random_character = $input[mt_rand(0, $input_length - 1)];                     $random_string .= $random_character;                 }                  return $random_string;             }              \/\/\u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043d\u0430 \u043f\u043e\u0432\u0442\u043e\u0440\u0435\u043d\u0438\u0435 link - \u043d\u0430\u043c \u0436\u0435 \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0447\u0442\u043e\u0431\u044b \u043a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043b\u0438\u0441\u044c \u043d\u043e\u0432\u044b\u0435 \u0441\u0441\u044b\u043b\u043a\u0438. link - \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0439.             $check = new DB\\SQL\\Mapper($db,'links');             $check-&gt;load(array('link=&quot;'. $link .'&quot;'));             if ($check-&gt;dry()) {                 $g_code = generate_string($permitted_chars);                 $row = new DB\\SQL\\Mapper($db,'links');                 $row-&gt;reset();                 $row-&gt;code = $g_code;                 $row-&gt;link = $link;                 $row-&gt;save();             } else {                 $g_code = $check-&gt;code; \/\/\u0435\u0441\u043b\u0438 link \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u0435\u0442\u0441\u044f, \u0442\u043e \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u0441\u0442\u0430\u0440\u044b\u0439 \u043a\u043e\u0434             }              $short_link = 'https:\/\/'. $_SERVER['HTTP_HOST'] . '\/' . $g_code; \/\/\u0441\u043e\u0431\u0438\u0440\u0430\u0435\u043c \u043a\u043e\u043d\u0435\u0447\u043d\u0443\u044e \u0441\u0441\u044b\u043b\u043a\u0443              \/\/\u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0438\u0437 $_POST \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e $f3-&gt;get('POST'), \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0442\u043e\u0447\u0435\u0447\u043d\u0430\u044f \u043d\u043e\u0442\u0430\u0446\u0438\u044f (\u043f\u043e\u043f\u0440\u0430\u0432\u044c\u0442\u0435, \u0435\u0441\u043b\u0438 \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u043d\u0430\u0437\u044b\u0432\u0430\u044e): \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 &quot;link&quot; \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0442\u0430\u043a:              $link = $f3-&gt;get('POST.link');              if ( !empty($f3-&gt;get('POST')) ) { \/\/\u0412\u044b\u0434\u0430\u0435\u043c HTML, \u0442\u043e\u043b\u044c\u043a\u043e \u0435\u0441\u043b\u0438 POST \u043d\u0435 \u043f\u0443\u0441\u0442\u043e\u0439.              $f3-&gt;set('link', $short_link);             $f3-&gt;set('hits', $check-&gt;hits);             $view = new View;             echo $view-&gt;render('newLink.htm');              } else { \/\/\u0438\u043d\u0430\u0447\u0435 - \u0440\u0435\u0434\u0438\u0440\u0435\u043a\u0442 \u043d\u0430 \u0433\u043b\u0430\u0432\u043d\u0443\u044e                 $f3-&gt;$f3-&gt;reroute('\/');             }          } );<\/code><\/pre>\n<p>  <\/p>\n<p>\u0413\u043e\u0442\u043e\u0432\u043e! \u041d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435, \u044d\u0442\u043e \u0431\u044b\u043b\u043e \u043f\u0440\u043e\u0441\u0442\u043e.<\/p>\n<p>  <\/p>\n<h2 id=\"perenapravlenie\">\u041f\u0435\u0440\u0435\u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435<\/h2>\n<p>  <\/p>\n<p>\u0414\u0435\u043b\u043e \u043e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u0437\u0430 \u043c\u0430\u043b\u044b\u043c:<\/p>\n<p>  <\/p>\n<ol>\n<li>\u041f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u0438\u0437 URL<\/li>\n<li>\u041f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0435\u0433\u043e \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u0432 \u0411\u0414<\/li>\n<li>\u041f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0438\u0437 \u0411\u0414 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0443\u044e \u0441\u0441\u044b\u043b\u043a\u0443<\/li>\n<li>\u041f\u0435\u0440\u0435\u043d\u0430\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f<\/li>\n<li>Profit!<\/li>\n<\/ol>\n<p>  <\/p>\n<p>\u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0435\u043c \u043f\u0438\u0441\u0430\u0442\u044c \u043a\u043e\u0434 \u043f\u043e\u0441\u043b\u0435 \u043f\u0440\u043e\u0448\u043b\u043e\u0433\u043e \u0420\u043e\u0443\u0442\u0430.<\/p>\n<p>  <\/p>\n<pre><code class=\"php\">$f3-&gt;route('GET \/@code', \/\/\u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u043f\u043e\u0441\u043b\u0435 &quot;@&quot;, \u043e\u043d \u043f\u043e\u043f\u0430\u0434\u0435\u0442 \u0432 PARAMS     function($f3) {          \/\/\u0441\u043d\u043e\u0432\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c $db         $db = new DB\\SQL(             'mysql:host=localhost;port=3306;dbname=linker',             'root',             ''         );          $code = $f3-&gt;get('PARAMS.code'); \/\/\u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440          $link = new DB\\SQL\\Mapper($db,'links');           \/\/\u0435\u0441\u043b\u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441\u0441\u044b\u043b\u043a\u0443 \u0438\u0437 \u0411\u0414 - \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c, \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0435\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u043e\u0432 \u0438 \u043f\u0435\u0440\u0435\u043d\u0430\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c         if ($link-&gt;load(array('code=&quot;'.$code.'&quot;', 'link=?'))) {             $link-&gt;hits++;             $link-&gt;save();              $f3-&gt;reroute($link-&gt;link);         } else {             $f3-&gt;reroute('\/'); \/\/\u0430 \u0435\u0441\u043b\u0438 \u0442\u0430\u043a\u043e\u0439 \u0441\u0441\u044b\u043b\u043a\u0438 \u043d\u0435\u0442 - \u043c\u0438\u043b\u043e\u0441\u0442\u0438 \u043f\u0440\u043e\u0441\u0438\u043c \u043d\u0430 \u0433\u043b\u0430\u0432\u043d\u0443\u044e         }     } );<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412\u044b \u043c\u043e\u0433\u043b\u0438 \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u0432 \u0438 \u0432 \u0440\u043e\u0443\u0442\u0435 <em>newLink,<\/em> \u0438 \u0432 \u0440\u043e\u0443\u0442\u0435 \u0432\u044b\u0448\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u0441\u044f \u043e\u0434\u043d\u043e \u0438 \u0442\u043e\u0436\u0435 \u2014 \u0432\u0435\u0434\u044c <em><a href=\"https:\/\/habr.com\/ru\/users\/code\/\" class=\"user_link\">code<\/a><\/em> \u043c\u043e\u0436\u0435\u0442 \u0441\u043e\u0432\u043f\u0430\u0441\u0442\u044c \u0441 &quot;newLink&quot; (\u043d\u0435 \u043c\u043e\u0436\u0435\u0442, \u0432 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0431\u0443\u043a\u0432\u044b \u0432\u0435\u0440\u0445\u043d\u0435\u0433\u043e \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430), \u043d\u043e \u0442\u0430\u043a \u043a\u0430\u043a \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d \u043e\u043d, \u0442\u043e \u043e\u043d \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0441\u044f \u043f\u0435\u0440\u0432\u044b\u043c.<\/p>\n<p>  <\/p>\n<h2 id=\"f3run\">$f3\u2192run()!<\/h2>\n<p>  <\/p>\n<p>\u0421\u043f\u0430\u0441\u0438\u0431\u043e \u0437\u0430 \u043f\u0440\u043e\u0447\u0442\u0435\u043d\u0438\u0435!<br \/>  \u042f \u0431\u0443\u0434\u0443 \u0440\u0430\u0434, \u0435\u0441\u043b\u0438 \u0412\u044b \u043d\u0430\u043f\u0438\u0448\u0435\u0442\u0435 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0439, \u0438 \u043f\u043e\u043f\u0440\u0430\u0432\u0438\u0442\u0435 \u0435\u0441\u043b\u0438 \u0447\u0442\u043e \u043d\u0435 \u0442\u0430\u043a. <\/p>\n<p>  <\/p>\n<p>\u0410 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0434\u043e\u043c\u0430\u0448\u043d\u0435\u0433\u043e \u0437\u0430\u0434\u0430\u043d\u0438\u044f \u0438\u043b\u0438 \u0434\u043e\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c\u0441\u0442\u0432\u0430 \u043b\u0435\u043d\u0438 \u0430\u0432\u0442\u043e\u0440\u0430 (\u043c\u0435\u043d\u044f), \u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e \u0441\u043f\u0438\u0441\u043e\u0447\u0435\u043a, \u0447\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c. \u0412\u0435\u0434\u044c \u043b\u0443\u0447\u0448\u0435 \u0443\u0447\u0438\u0442\u044c\u0441\u044f \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435!<\/p>\n<p>  <\/p>\n<ul>\n<li>\u042d\u0442\u043e \u043a\u043e\u043d\u0435\u0447\u043d\u043e \u043c\u0430\u043b\u043e\u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e, \u043d\u043e \u043f\u0440\u0438 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 <em>$g_code<\/em> \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u0432\u0442\u043e\u0440\u0438\u0442\u044c\u0441\u044f, \u0442\u0430\u043a \u0447\u0442\u043e \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e \u0432\u0430\u043c \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u044d\u0442\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c.<\/li>\n<li>\u0415\u0449\u0435 \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u0443\u044e \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0443 \u0438 \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u044c \u0435\u0435 \u043f\u043e \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0443 \u043d\u0430 <em>\/@code\/stats<\/em><\/li>\n<li>\u0417\u0430\u043f\u0440\u0435\u0442\u0438\u0442\u044c \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0441\u0441\u044b\u043b\u043a\u0438 \u043d\u0430 \u0441\u0430\u043c \u0441\u0435\u0440\u0432\u0438\u0441 \u0441\u043e\u043a\u0440\u0430\u0449\u0435\u043d\u0438\u044f \u0441\u0441\u044b\u043b\u043e\u043a, \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0441\u043f\u0438\u0441\u043e\u043a &quot;\u0437\u0430\u0449\u0438\u0449\u0435\u043d\u043d\u044b\u0445&quot; \u043e\u0442 \u0443\u043a\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u043d\u0438\u044f \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432 <\/li>\n<li>\n<blockquote><p>\u041d\u0430\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e \u0434\u0430\u0436\u0435 \u0432 \u0442\u0430\u043a\u043e\u043c \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u043e\u043c \u0434\u0435\u043b\u0435 \u0434\u0435\u043b\u0430\u0442\u044c \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044e \u0432\u0432\u043e\u0434\u0430 \u0438 \u043d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 \u0441\u0435\u0440\u0432\u0435\u0440\u0430, \u0441 \u0432\u044b\u0432\u043e\u0434\u043e\u043c \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u043e\u0448\u0438\u0431\u043e\u043a, \u043d\u0435 \u0441\u0442\u043e\u0438\u0442 \u043f\u043e\u043b\u0430\u0433\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0430\u0442\u0442\u0440\u0438\u0431\u0443\u0442\u0430 required \u0438 \u0442\u0438\u043f\u0430 type=\u00aburl\u00bb \u043a \u043f\u043e\u043b\u044e \u0432\u0432\u043e\u0434\u0430 <br \/>  <a href=\"https:\/\/habr.com\/ru\/users\/redcomrade\/\" class=\"user_link\">RedComrade<\/a> <\/p><\/blockquote>\n<p>  <\/li>\n<li>\n<p>\u041f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0439\u0442\u0435 \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0438&#8230;<\/p>\n<p>  <\/p>\n<p>\u041d\u0430 \u0441\u0432\u044f\u0437\u0438)<\/p>\n<p>  <\/li>\n<\/ul>\n<\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/515636\/\"> https:\/\/habr.com\/ru\/post\/515636\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/515636\/\">\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/xn\/67\/jz\/xn67jzqjb8k4jfeeje-stzezwi0.png\"><\/p>\n<p>  <\/p>\n<p>\u0421\u043e\u043a\u0440\u0430\u0449\u0430\u0442\u044c \u0441\u0441\u044b\u043b\u043a\u0438 \u0432 13 \u043b\u0435\u0442 \u043d\u0435 \u0441\u0442\u044b\u0434\u043d\u043e, \u0432\u0435\u0440\u043d\u043e?<br \/>  \u041d\u043e\u0432\u0438\u0447\u043a\u0443, \u0434\u0430 \u0438 \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u043e\u0432\u0438\u0447\u043a\u0443, \u0441\u0442\u043e\u0438\u0442 \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0432\u043e\u0439 \u0423\u043a\u0440\u043e\u0442\u0438\u0442\u0435\u043b\u044c \u0421\u0441\u044b\u043b\u043e\u043a, \u043f\u043e\u0445\u043e\u0434\u0443 \u0438\u0437\u0443\u0447\u0430\u044f \u043a\u0430\u043a\u043e\u0439-\u043d\u0438\u0431\u0443\u0434\u044c \u043d\u043e\u0432\u044b\u0439 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a. \u0427\u0435\u043c \u044f \u0438 \u0437\u0430\u043d\u044f\u043b\u0441\u044f. \u0427\u0442\u043e \u0441\u043a\u0430\u0437\u0430\u0442\u044c \u2014 \u043f\u044f\u0442\u044b\u0439 \u0431\u0443\u0442\u0441\u0442\u0440\u0430\u043f, \u043e\u0431\u0435\u0437\u0436\u0438\u0440\u0435\u043d\u043d\u044b\u0439 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a \u0438 \u0447\u0430\u0441\u0442\u0438\u0447\u043a\u0430 \u0434\u0443\u0448\u0438. <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-308661","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/308661","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=308661"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/308661\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=308661"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=308661"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=308661"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}