yii2 composer update和composer global updateyii2 之间有什么区别?
我使用波纹管功能在上传后调整图像大小以显示在我的帖子上.但它适用于大于500px 300px的图像.当我上传小于这个尺寸的图片时,我的网站图片行会中断.
use yii\imagine\Image;
public function upload() {
$this->pictureFile->saveAs('../files/upload/' . $this->pictureFile->baseName . '.' . $this->pictureFile->extension);
Image::thumbnail('../files/upload/' . $this->pictureFile, 500, 300)
->save('../files/upload/thumbnail-500x300/' . $this->pictureFile->baseName . '.' . $this->pictureFile->extension,
['quality' => 70]);
unlink('../files/upload/' . $this->pictureFile->baseName . '.' . $this->pictureFile->extension);
}
Run Code Online (Sandbox Code Playgroud) 我是 yii2 的初学者。我想显示帖子创建的时间。我使用波纹管函数来获取它,但结果只是0 分钟前。谁能帮我?
<?php
function notifyDate($myStartDate) {
$now = Yii::$app->jdate->date('Y/m/d') . '- ' . date('H:i:s');
$datediff = $now - $myStartDate;
if ($datediff < (60 * 60)) { // Minutes
return floor($datediff / (60 * 60 * 24)) . " Minutes ago ";
}
if ($datediff < (60 * 60 * 24)) { // Hours
return floor($datediff / (60 * 60 * 24)) . " Hours ago ";
}
// this return the number of day
return floor($datediff …Run Code Online (Sandbox Code Playgroud) 我通过在项目中使用xampp在Windows 10中使用yii2,但是composer命令根本不执行任何操作。
要了解更多,我要补充这个,那个作曲家指挥工作中的每一个路径 exept 一个项目。
我的composer.json:
{
"name": "yiisoft/yii2-app-advanced",
"description": "Yii 2 Advanced Project Template",
"keywords": ["yii2", "framework", "advanced", "project template"],
"homepage": "http://www.yiiframework.com/",
"type": "project",
"license": "BSD-3-Clause",
"support": {
"issues": "https://github.com/yiisoft/yii2/issues?state=open",
"forum": "http://www.yiiframework.com/forum/",
"wiki": "http://www.yiiframework.com/wiki/",
"irc": "irc://irc.freenode.net/yii",
"source": "https://github.com/yiisoft/yii2"
},
"minimum-stability": "stable",
"require": {
"php": ">=5.4.0",
"yiisoft/yii2": ">=2.0.6",
"yiisoft/yii2-bootstrap": "*",
"yiisoft/yii2-swiftmailer": "*",
"franciscomaya/yii2-sceditor": "dev-master",
"kartik-v/yii2-widget-sidenav": "*",
"mohammad-mahdy/yii2-jdate": "*",
"2amigos/yii2-ckeditor-widget" : "*",
"2amigos/yii2-gallery-widget": "~1.0",
"romka-chev/yii2-swiper" : "*",
"kartik-v/yii2-widgets": "*",
"kartik-v/yii2-grid": "@dev",
"yiisoft/yii2-imagine": "*",
"omnilight/yii2-shopping-cart": "*", …Run Code Online (Sandbox Code Playgroud) 我最近没有改变任何东西,xampp直到昨天它都可以正常工作。
但现在我收到了这个错误:
Object not found!
The requested URL was not found on this server. If you entered the URL manually please check your spelling and try again.
If you think this is a server error, please contact the webmaster.
Error 404
localhost
Apache/2.4.10 (Win32) OpenSSL/1.0.1i PHP/5.6.3
Run Code Online (Sandbox Code Playgroud)
我不知道发生了什么,因为它一直工作到昨天。
而且我不得不说这个地址localhost/phpmyadmin工作正常,只是我的项目地址localhost/project22不工作。
如何在 yii2 上的行中创建URLDetailView?
例如:blow 代码类似于 中的自定义行GridView,但正如您所知,DetailView它是不同的,并且此代码在 中不起作用DetailView。
<?= DetailView::widget([
'model' => $model,
'attributes' => [
[
'attribute' => 'file',
'label' => 'File',
'fomat' => 'Url', // I want something like this
'value' => Html::a('Dowaload The File', ['files/uloads']),
],
])
Run Code Online (Sandbox Code Playgroud)
我还没有在类似的问题中找到我的问题的解决方案。
请帮助我Url在DetailView中创建行。
我用Yii2编写了我的网站.当我刷新我的网站时,它就像Ctl + F5,并且我的网站的所有font awesome和所有缓存再次重新加载.看起来好像我第一次打开页面.