$headers = 'HTTP/1.1 301 Moved Permanently Location: https://www.google.com/ Content-Type: text/html; charset=UTF-8 Date: Fri, 04 May 2018 17:59:00 GMT Expires: Sun, 03 Jun 2018 17:59:00 GMT Cache-Control: public, max-age=2592000 Server: gws Content-Length: 220 X-XSS-Protection: 1; mode=block X-Frame-Options: SAMEORIGIN Alt-Svc: hq=":443"; ma=2592000; quic=51303433; quic=51303432; quic=51303431; quic=51303339; quic=51303335,quic=":443"; ma=2592000; v="43,42,41,39,35" Connection: close';
if (preg_match("/Content-Type: (.*)/ui", $headers, $match)) {
$headers_part = $match[1];
}
в каждом layout
class AlbumTest extends TestCase
{
use DatabaseMigrations;
public function test()
{
$album = factory('Album')->create();
$songs = new Collection([
factory('Song')->make(['duration' => 291]),
factory('Song')->make(['duration' => 123]),
factory('Song')->make(['duration' => 100]),
]);
$album->songs()->saveMany($songs);
}
}
public function actionCreate()
{
$product_count = Product::find()->count();
while ($product_count < 10) {
$model = new Product;
$model->category_id='2';
$model->author_id=$app->user->identity['id'];
$model->name='name';
$model->content='content';
$model->price='0';
$model->keywords='NULL';
$model->description='NULL';
$model->hit='0';
$model->new='0';
if ($model->save()) {
$product_count++;
}
}
}
$this->data = Category::find()->all;
$this->data = Category::find()->all();
$class_name = 'Like'.mb_strtoupper($object_type);
$class_name::createNotification($auth->user_id, $object_id);
$bytes = random_bytes(12);
var_dump(bin2hex($bytes));