'db' => [
'class' => 'yii\db\Connection',
'dsn' => 'mysql:host=localhost;dbname=fedorov_shop',
'username' => 'fedorov_shop',
'password' => '***',
'charset' => 'utf8',
'enableSchemaCache' => true,
'schemaCacheDuration' => 3600,
]
php yii migrate --db=db
public function init()
{
$this->db = 'db2';
parent::init();
}
public function init()
{
parent::init();
Yii::$app->view->setAssetManager(new AssetManager());
}
<?php
<?php
$arResult["ID"] = 5;
$delaydBasketItems = [2,4,3,6,5];
?>
<input type="checkbox" name="test" id="test">
<?php
if ( in_array($arResult["ID"], $delaydBasketItems) || isset($itInDelay) ) {
?>
<script>
$('#test').attr('checked', true);
</script>
<?php } ?>
<?php echo $color ?>
или <?= $color ?>
<?php
$type = 'add';
$color = $type == 'add' ? 'red' : 'white';
?>
<table style="width: 200px; height: 100px;">
<tr style="background:<?= $color ?>">
<td></td>
<td></td>
<td></td>
</tr>
<tr style="background:<?= $color ?>">
<td></td>
<td></td>
<td></td>
</tr>
<tr style="background:<?= $color ?>">
<td></td>
<td></td>
<td></td>
</tr>
<tr style="background:<?= $color ?>">
<td></td>
<td></td>
<td></td>
</tr>
</table>
composer dump-autoload
$upd = mysqli_query($db, "UPDATE golosa SET id=1, var1 = '$row[0]' ");
$upd = mysqli_query($db, "UPDATE `golosa_vote` SET `var1` = '$row[0]' WHERE ` id`=1");
function login($url,$login,$pass){
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
// откуда пришли на эту страницу
curl_setopt($ch, CURLOPT_REFERER, $url);
// cURL будет выводить подробные сообщения о всех производимых действиях
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_POST, 1);
//curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,"username=".$login."&password=".$pass);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.87 Safari/537.36");
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
//сохранять полученные COOKIE в файл
curl_setopt($ch, CURLOPT_COOKIEJAR, $_SERVER['DOCUMENT_ROOT'].'/parser/cookie.txt');
curl_setopt($ch, CURLOPT_COOKIEFILE, $_SERVER['DOCUMENT_ROOT'].'/parser/cookie.txt');
$result=curl_exec($ch);
//echo $result;
curl_close($ch);
return $result;
}
$baseUrlFrontend = str_replace('backend/web', '', (new Request)->getBaseUrl());
return [
'components' => [
'cache' => [
'class' => 'yii\caching\FileCache',
],
'urlManagerFrontend' => [
'class' => 'yii\web\UrlManager',
'baseUrl' => $baseUrlFrontend,
'enablePrettyUrl' => true,
'showScriptName' => false,
]
]
]
$img = (Yii::$app->urlManagerFrontend->createUrl( $model->images[0]['path'] . DIRECTORY_SEPARATOR . $model->images[0]['title']));
echo Html::img($img);
echo Html::img('@web/' . $model->images[0]['path'] . DIRECTORY_SEPARATOR . $model->images[0]['title']);
Вкратце о скилах
Вкратце о навыках
планирую изучить WordPress,
PHP -> ООП -> Framework's
for($i=1; $i <=2 ; $i++){
define('HOST','http://karabanoff.ru/all_news/page/'.$i)
}
for($i=1; $i <=2 ; $i++){
$url = 'http://karabanoff.ru/all_news/page/'.$i;
}
<input type="checkbox" name="name" <?= isset($_GET['name']) ? 'checked="checked"' : null ?> />
$a.if
if ($a) {
}
$a>=0.if
if ($a>=0) {
}
$this->alterColumn('category','id',$this->smallInteger(8).'NOT NULL AUTO_INCREMENT');
// for hasOne()
'value' => function($model){
return $model->country->name ?? null;
}
// for hasMany()
'value' => function($model){
return implode(',', ArrayHelper::map($model->country, 'id', 'name'));
}
'value' => 'country.name'
public function getImagesLinks()
{
$path = ArrayHelper::getColumn(self::find()->all(), 'pathImg');
return $path;
}
public function getImagesLinksData()
{
$files = UploadsFiles::find()->all();
return ArrayHelper::toArray($files,[
UploadsFiles::class => [
'caption' => 'file',
'key' => 'id'
]
]);
}
echo $form->field($model, 'imagesFile')->widget(FileInput::class, [
'options' => ['accept' => 'image/*', 'multiple' => true],
'pluginOptions' => [
'showUpload' => false,
'showRemove' => false,
'overwriteInitial'=>false,
'initialPreviewAsData' => true,
'initialPreview' => $model->imagesLinks,
'initialPreviewConfig' => $model->imagesLinksData,
'uploadUrl' => Url::to(['upload-img']),
'deleteUrl' => Url::to(['delete-img']),
]
])->label('<h3>Test Img</h3>');
$model->load()
. Поэтому со скрытым input всё работает.$model = new Direction();
$modelLang = new DirectionLang();
if ($modelLang->load(Yii::$app->request->post()) && $model->save()) {
$modelLang->lang_id = 2;
$modelLang->direction_id = $model->id;
$modelLang->save();
var_dump($model->getErrors());
var_dump($modelLang->getErrors());
return $this->redirect(['view', 'id' => $model->id]);
}