Код: Выделить всё
class Book extends ActiveRecord
{
public static function tableName()
{
return '{{book}}';
}
}
Код: Выделить всё
use frontend\models\Book;
class BookshopController extends \yii\web\Controller
{
public function actionIndex()
{
$book = new Book();
$book->name = 'Test book';
$book->isbn = '878978878';
$book->save();
return $this->render('index');
}
}
Подскажите, пожалуйста, почему при переходе на страницу bookshop/index в БД дважды записывается одна и та же строка, будто я два раза подряд прошел по этому адресу? Один человек имел похожую проблему из-за .htaccess. У меня он такой:
Код: Выделить всё
RewriteEngine on
# If a direcrory or a file exists, use the request directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Otherwise forward the request to index.php
RewriteRule . index.php.