$path = 'uploads/image.png';
$image = new Imagick($path);
$image->setImageFormat('png');
header('Content-type: image/png');
echo $image->getImageBlob();
$image->close();
<img src="image.php">
RewriteEngine on
RewriteRule ^.*$ index.php [NC,L]
if (parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH) != '/index.php') {
header('Location: /index.php');
}
UPDATE `table` SET `random` = RAND()
public static function model($className=__CLASS__)
{
if(isset(self::$_models[$className]))
return self::$_models[$className];
else
{
$model=self::$_models[$className]=new $className(null);
$model->attachBehaviors($model->behaviors());
return $model;
}
}
public function findByPk($pk,$condition='',$params=array())
{
Yii::trace(get_class($this).'.findByPk()','system.db.ar.CActiveRecord');
$prefix=$this->getTableAlias(true).'.';
$criteria=$this->getCommandBuilder()->createPkCriteria($this->getTableSchema(),$pk,$condition,$params,$prefix);
return $this->query($criteria);
}
public $fields = [];
public function rules() {
return [
...
['fields', 'validateFields'],
...
];
}
public function validateFields() {
for ($i = 0; $i < count($this->fields); ++$i) {
...
}
}
<?php $form->field($model, 'fields[]') ?>