My project
My operations system (OP) is a linux ubuntu desktop.
.htccess
Options +FollowSymLinks
IndexIgnore */*
RewriteEngine on
# if a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# otherwise forward it to index.php
RewriteRule . index.php
in web folder i created a picture folder.
in picture folder-> BMW.jpg
index.php
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
use yii\helpers\Url;
use yii\helpers\ArrayHelper;
/* @var $this yii\web\View */
$this->title = ‘My Yii Application’;
?>
<img src='".Yii::$app->request->baseUrl."/picture/BMW.jpg'>
<?php echo Url::to('/picture/BMW.jpg'); ?>
<?php echo Html::img(Yii::$app->params['baseUrl'] .'/web/picture/BMW.jpg', ['width'=>'350','height'=>'200'],['alt' => 'alt image']);?>
<?php echo Html::img('picture/BMW.jpg') ?>
<?php echo Html::img('@web/picture/pic.jpg') ?>
Does not work! Why?
Thanks for your help!