use mako\security\Password; // パスワードハッシュ $hash = Password::hash('password'); // パスワードハッシュの検証 $valid = Password::validate('password', $hash);
参考サイト
Password hashing(Mako Framework Documentation)
mako\security\Password (Mako Framework API)
', $toolbar . '', $body);
});
/app/config/database.php
'log_queries' => true,
'configurations' => [ 'test' => [ 'dsn' => 'mysql:dbname=sample;host=localhost;port=3306', 'username' => 'username', 'password' => 'password', 'persistent' => false, 'log_queries' => false, 'reconnect' => false, 'queries' => [ "SET NAMES UTF8", ], ], 'sqlite' => [ 'dsn' => 'sqlite:' . MAKO_APPLICATION_PATH . '/storage/database/test.sqlite', 'log_queries' => false, 'reconnect' => false, 'queries' => [ "PRAGMA encoding = 'UTF-8'", ], ], ],
$id = 5; $rows = $connection->all('SELECT * FROM `items` WHERE `id` >= ?', [$id]);実際に設定してみたサイトがこちら。
$ php reactor app.routes ------------------------------------------------------------------------ | Route | Allowed methods | Action | ------------------------------------------------------------------------ | / | GET, HEAD, OPTIONS | app\controllers\Index::welcome | | /articles/{id} | GET, HEAD, OPTIONS | Closure | | /blog/{id} | GET, HEAD, OPTIONS | app\controllers\Blog::show | | /blog/create | GET, POST | app\controllers\Blog::create | ------------------------------------------------------------------------実際に設定してみたサイトがこちら。
Appleが先日オープンソース化したSwiftを使ったPerfectは、OSXやLinux、Windows、iOS、Androidといった、複数のプラットフォームにまたがったクロスプラットフォーム開発のサポートを提供している。同社CEOのSean Stephens氏によると、Swiftをクライアントとサーバ両方で採用することによって、コードやロジックの再利用による開発プロセスの効率化が実現すると同時に、Swiftの持つ高レベルの安全性とセキュリティ、パフォーマンスを活用できる。
// 設定(3600は、秒数) $this->response->cookie('name', 'value', 3600); // 読み込み $name = $this->request->cookie('name'); // データの有無をチェック $hasCookie = $this->response->hasCookie('name'); // 削除 $this->response->removeCookie('name');実際に設定してみたサイトがこちら。
return $this->response->redirect('/'); return $this->response->redirect('/hello')->status(301);実際に設定してみたサイトがこちら。
$referer = $this->request->referer(); $ip = $this->request->ip(); $isAjax = $this->request->isAjax(); // HTTPSか否か $isSecure = $this->request->isSecure(); $baseURL = $this->request->baseURL(); // GETやPOSTなど $method = $this->request->method();実際に設定してみたサイトがこちら。
// すべて $all = $this->request->server(); $REMOTE_ADDR = $this->request->server("REMOTE_ADDR"); $HTTP_REFERER = $this->request->server("HTTP_REFERER"); $HTTP_USER_AGENT = $this->request->server("HTTP_USER_AGENT"); $REQUEST_METHOD = $this->request->server("REQUEST_METHOD"); $REQUEST_URI = $this->request->server("REQUEST_URI");実際に設定してみたサイトがこちら。