luoxiao
- luoxiao 赞了回答
你可以试试看phpword,应该能满足你的要求。https://github.com/PHPOffice/PHPWord.git。不光是phpword,这个老兄还写了phpexcel,phppowerpoint等。文档也写得很详尽,用起来也很简单,有doc,有examples,搞php的应该一看就懂。基于LGPL协议的。
- luoxiao 2016-02-29 已签到连续签到1天,获得了5个金钱
- luoxiao 赞了回答
台胞? 看得我好费劲 ...... 哈哈
先说
Yii::$app
的奥秘 :
看\yii\web\Application
这个抽象类的构造函数,
第一句就是 :Yii::$app = $this;
, 就是在这里完成的绑定;至于 如何阅读源码;
我觉得 不要为了阅读源码而阅读源码...
最好的方式是 实际使用中, 哪里出问题了, 哪里不清楚了, 去框架源码内追踪, 查看;
这样以点带面, 慢慢扩散开, 慢慢就理清了. - luoxiao 赞了回答
我是快乐的搬运工~
Bootstrap DatePicker Widget for Yii2
Latest Version Software License Build Status Coverage Status Quality Score Total DownloadsRenders a Bootstrap DatePicker plugin.
Installation
The preferred way to install this extension is through composer.
Either run
composer require 2amigos/yii2-date-picker-widget:~1.0
or add"2amigos/yii2-date-picker-widget" : "~1.0"
to the require section of your application's composer.json file.Usage
The widget comes in two flavors:
DatePicker
DateRangePicker
DatePickerThis widget renders a Bootstrap DatePicker input control. Best suitable for model with date string attribute.
Example of use with a form
There are two ways of using it, with an ActiveForm instance or as a widget setting up its model and attribute.<?php
use dosamigos\datepicker\DatePicker;// as a widget
?><?= DatePicker::widget([
'model' => $model, 'attribute' => 'date', 'template' => '{addon}{input}', 'clientOptions' => [ 'autoclose' => true, 'format' => 'dd-M-yyyy' ]
]);?>
<?php
// with an ActiveForm instance
?>
<?= $form->field($model, 'date')->widget(DatePicker::className(), [ // inline too, not bad 'inline' => true, // modify template for custom rendering 'template' => '<div class="well well-sm" style="background-color: #fff; width:250px">{input}</div>', 'clientOptions' => [ 'autoclose' => true, 'format' => 'dd-M-yyyy' ]
]);?>
Example of use without a model<?php
use dosamigos\datepicker\DatePicker;
?>
<?= DatePicker::widget(['name' => 'Test', 'value' => '02-16-2012', 'template' => '{addon}{input}', 'clientOptions' => [ 'autoclose' => true, 'format' => 'dd-M-yyyy' ]
]);?>
DateRangePickerThis widget renders a Bootstrap DateRangePicker Input control.
Example of use with a form
The following example works with a model that has two attributes named date_from and date_to.<?php
use dosamigos\datepicker\DateRangePicker;
?>
<?= $form->field($tour, 'date_from')->widget(DateRangePicker::className(), ['attributeTo' => 'date_to', 'form' => $form, // best for correct client validation 'language' => 'es', 'size' => 'lg', 'clientOptions' => [ 'autoclose' => true, 'format' => 'dd-M-yyyy' ]
]);?>
Example of use without a model<?php
use dosamigos\datepicker\DateRangePicker;
?>
<?= DateRangePicker::widget(['name' => 'date_from', 'value' => '02-16-2012', 'nameTo' => 'name_to', 'valueTo' => '02-20-2012'
]);?>
TestingTo test the extension, is better to clone this repository on your computer. After, go to the extensions folder and do the following (assuming you have composer installed on your computer):
$ composer install --no-interaction --prefer-source --dev
Once all required libraries are installed then do:$ vendor/bin/phpunit
I would recommend to have phpunit globally installed together with xdebug so you can have code coverage analysis too.Further Information
Please, check the Bootstrap DatePicker site documentation for further information about its configuration options.
Contributing
Please see CONTRIBUTING for details.
Credits
Antonio Ramirez
All Contributors - luoxiao 赞了回答
yii2生成文档用的是这个扩展 https://github.com/yiisoft/yii2-apidoc
- luoxiao 赞了回答
2种情况,一个是AController和BController中有很多功能或属性都是一样的,那可以把公共的放在基类里,让AController和BController去继承。另一个是AController和BController中只有少部分功能或属性两个控制器都会用到,那就把这些单独提取出来,写到一个Model里,或者在Controller和Model之间再定义一个Business类。如果BController的功能必须借助于AController中的属性,那代码实现本身可能有比较大的问题。
- luoxiao 收藏了问题你们都没有过控制器互相调用的需求么
- luoxiao 赞了回答
yii2-file-upload-widget,看看这个对你有没有用,源于jquery-file-upload