国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

Home Backend Development PHP Tutorial PHP development framework Yii Framework tutorial (8) Using FormModel

PHP development framework Yii Framework tutorial (8) Using FormModel

Jan 21, 2017 am 09:54 AM

Through the previous study, we have understood the basic components of Yii Web applications, and can also write simple applications like the Hangman word guessing game. In the first example Yii Framework development concise tutorial (1) the first application Hello World we introduced the MVC model adopted by Yii Web application, and also explained that the purpose of this tutorial is through different perspectives (mainly through the development of Windows applications C++, C# Programmer's perspective) helps Windows desktop application or ASP.Net programmers quickly master the PHP Yii Framework application framework.

Earlier we introduced creating View (page view Form) through CHtml and handling user submission events through CController. By analogy with Windows desktop applications or ASP.Net, Yii mid-view View (HTML Form) is similar to WinForm or Asp.Net Page. Control class Controller is similar to the event processing (Code-Behind) class of Windows desktop applications or Asp.Net. The difference is that Asp.Net and Windows desktop applications can define IDs for each UI component in the UI, such as text boxes and buttons, and then add event processing for different UI components. There is no corresponding mechanism for PHP applications or Yii applications to define an Id for UI components defined in HTML Form and define event handling for UI components. However, the Yii framework provides CFormModel to support similar functions. Simply put, through CFormModel, variables can be defined for UI widgets in HTML Form, and these variables can be accessed in its control class Controller. Each Yii View (Form) generally provides a "Submit Button". The user clicks this "Submit Button" to trigger the actionXXX method corresponding to the CController object. In the actionXXX method, the UI components of the HTML Form can be accessed through CFormModel. value.

As mentioned in the previous tutorial, the model in Yii is an instance of CModel or its subclass. Models are used to maintain data and related business logic.

Yii implements two types of models: form models and Active Record. Both inherit from the same base class CModel.

The form model is an instance of CFormModel. The form model is used to hold data obtained from the user's input. This data is often acquired, used, and then discarded. For example, in a login page, we can use the form model to represent the username and password information provided by the end user. For more details, please refer to the usage form. This article introduces the usage of CFormModel.

Active Record (AR) is a design pattern used to abstract database access through an object-oriented style. Each AR object is an instance of CActiveRecord or one of its subclasses. Represents a row in the data table. The fields in the row correspond to properties in the AR object. For more details about AR, please read Active Record. We will introduce it later when we introduce the use of databases.

This article uses a simple login interface to introduce the usage of FormModel. Download this example.

1. Define the model class

Below we create a LoginForm (protected/models/LoginForm.php) model class for collecting user input in a login page. Since the login information is only used to authenticate the user and does not need to be saved, we create LoginForm as a form model.

class LoginForm extends
CFormModel    
{    
    public $username;    
    public $password;    
    public $rememberMe=false;    
}

2. Declare validation rules
Once the user submits his input and the model is populated, we need to ensure that the user's input is valid before use. This is achieved by validating the user's input against a series of rules. We specify these validation rules in the rules() method, which should return an array of rule configurations.

class LoginForm extends CFormModel    
{    
    public $username;    
    public $password;    
    public $rememberMe=false;    
        
    private $_identity;    
        
    public function rules()    
    {    
        return array(    
            array('username, password', 'required'),    
            array('rememberMe', 'boolean'),    
            array('password', 'authenticate'),    
        );    
    }    
        
    public function authenticate($attribute,$params)    
    {    
        $this->_identity=new UserIdentity($this->username,    
              $this->password);    
        if(!$this->_identity->authenticate())    
            $this->addError('password','錯(cuò)誤的用戶名或密碼。');    
    }    
}

The above code specifies: username and password are required, password should be authenticated, and rememberMe should be a Boolean value.

rules() Each rule returned must be in the following format:

array('AttributeList', 'Validator',
'on'=>'ScenarioList', ...附加選項(xiàng))

where AttributeList (attribute list) is the attribute list string that needs to be verified by this rule, Each attribute name is separated by commas; Validator (validator) specifies the type of validation to be performed; the on parameter is optional and specifies the list of scenarios to which this rule should be applied; additional options are an array of name-value pairs for Initializes the property values ??of the corresponding validator.

There are three ways to specify Validator in validation rules. First, Validator can be the name of a method in the model class, like authenticate in the example above. The verification method must be of the following structure:

/**   
 * @param string 所要驗(yàn)證的特性的名字   
 * @param array 驗(yàn)證規(guī)則中指定的選項(xiàng)   
 */
public function ValidatorName($attribute,$params) { ... }

第二,Validator 可以是一個(gè)驗(yàn)證器類的名字,當(dāng)此規(guī)則被應(yīng)用時(shí), 一個(gè)驗(yàn)證器類的實(shí)例將被創(chuàng)建以執(zhí)行實(shí)際驗(yàn)證。規(guī)則中的附加選項(xiàng)用于初始化實(shí)例的屬性值。 驗(yàn)證器類必須繼 承自 CValidator。

第三,Validator 可以是一個(gè)預(yù)定義的驗(yàn)證器類的別名。在上面的例子中, required 名字是 CRequiredValidator 的別名,它用于確保所驗(yàn)證的特性值不為空。 下面是預(yù)定義的驗(yàn)證器別名的完整列表:

boolean: CBooleanValidator 的別名, 確保特性有一個(gè) CBooleanValidator::trueValue 或CBooleanValidator::falseValue 值。

captcha: CCaptchaValidator 的別名,確保特性值等于 CAPTCHA 中顯示的驗(yàn)證碼。

compare: CCompareValidator 的別 名,確保特性等于另一個(gè)特性或常量。

email: CEmailValidator 的別名,確保特性是一個(gè)有效的Email地址。

default: CDefaultValueValidator 的別名,指定特性的默認(rèn)值。

exist: CExistValidator 的別名,確保特性值可以在指定表的列中 可以找到。

file: CFileValidator 的別名,確保特性含有一個(gè)上傳文件的名字。

filter: CFilterValidator 的別名,通 過一個(gè)過濾器改變此特性。

in: CRangeValidator 的別名,確保數(shù)據(jù)在一個(gè)預(yù)先指定的值的范圍之內(nèi)。

length: CStringValidator 的別名,確保數(shù)據(jù)的長(zhǎng)度在一個(gè)指定的范圍之內(nèi)。

match: CRegularExpressionValidator 的別名,確保 數(shù)據(jù)可以匹配一個(gè)正則表達(dá)式。

numerical: CNumberValidator 的別名,確保數(shù)據(jù)是一個(gè)有效的數(shù)字。

required: CRequiredValidator 的別名,確保特性不為空。

type: CTypeValidator 的別名,確保特性是指定的數(shù)據(jù)類型。

unique: CUniqueValidator 的別名,確保數(shù)據(jù)在數(shù)據(jù)表的列中是唯一的。

url: CUrlValidator 的別名,確保數(shù)據(jù)是一個(gè)有效的 URL 。

下面我們列出了幾個(gè)只用這些預(yù)定義驗(yàn)證器的示例:

// 用戶名為必填項(xiàng)    
array('username', 'required'),    
// 用戶名必須在 3 到 12 個(gè)字符之間    
array('username', 'length', 'min'=>3, 'max'=>12),    
// 在注冊(cè)場(chǎng)景中,密碼password必須和password2一致。    
array('password', 'compare', 'compareAttribute'=>'password2', 'on'=>'register'),    
// 在登錄場(chǎng)景中,密碼必須接受驗(yàn)證。    
array('password', 'authenticate', 'on'=>'login'),

3. 安全的特性賦值

在一個(gè)類的實(shí)例被創(chuàng)建后,我 們通常需要用最終用戶提交的數(shù)據(jù)填充它的特性。 這可以通過如下塊賦值(massive assignment)方式輕松實(shí)現(xiàn):

$model=new LoginForm;
if(isset($_POST['LoginForm']))
$model->attributes=$_POST['LoginForm'];最后的表達(dá)式被稱作 塊賦值(massive assignment) ,它將 $_POST['LoginForm'] 中的每一項(xiàng)復(fù)制到相應(yīng)的模型特性中。這相當(dāng)于如下賦值方法:

foreach($_POST
['LoginForm'] as $name=>$value)    
{    
    if($name 是一個(gè)安全的特性)    
        $model->$name=$value;    
}

檢測(cè)特性的安全非常重要,例如,如果我們以為一個(gè)表的主鍵是安全的而暴露了它,那么攻擊者可能就獲得了一個(gè)修 改記錄的主鍵的機(jī)會(huì), 從而篡改未授權(quán)給他的內(nèi)容。

檢測(cè)特性安全的策略在版本 1.0 和 1.1 中是不同的,下面我們將 分別講解:

1.1 中的安全特性

在版本 1.1 中,特性如果出現(xiàn)在相應(yīng)場(chǎng)景的一個(gè)驗(yàn)證規(guī)則中,即被認(rèn)為是安全的 。 例如:

array('username, password', 'required', 'on'=>'login, register'),
array('email', 'required', 'on'=>'register'),如上所示, username 和 password 特性在 login 場(chǎng)景中是必 填項(xiàng)。而 username, password 和 email 特性在register 場(chǎng)景中是必填項(xiàng)。 于是,如果我們?cè)?login 場(chǎng)景中執(zhí)行塊賦值,就 只有 username 和 password 會(huì)被塊賦值。 因?yàn)橹挥兴鼈兂霈F(xiàn)在 login 的驗(yàn)證規(guī)則中。 另一方面,如果場(chǎng)景是 register , 這三個(gè)特性就都可以被塊賦值。

// 在登錄場(chǎng)景中    
$model=new User('login');    
if(isset($_POST['User']))    
    $model->attributes=$_POST['User'];    
        
// 在注冊(cè)場(chǎng)景中    
$model=new User('register');    
if(isset($_POST['User']))    
    $model->attributes=$_POST['User'];

那么為什么我們使用這樣一種策略來檢測(cè)特性是否安全呢? 背后的基 本原理就是:如果一個(gè)特性已經(jīng)有了一個(gè)或多個(gè)可檢測(cè)有效性的驗(yàn)證規(guī)則,那我們還擔(dān)心什么呢?

請(qǐng)記住,驗(yàn)證規(guī)則是 用于檢查用戶輸入的數(shù)據(jù),而不是檢查我們?cè)诖a中生成的數(shù)據(jù)(例如時(shí)間戳,自動(dòng)產(chǎn)生的主鍵)。 因此,不要 為那些不接受 最終用戶輸入的特性添加驗(yàn)證規(guī)則。

有時(shí)候,我們想聲明一個(gè)特性是安全的,即使我們沒有為它指定任何規(guī)則。 例如, 一篇文章的內(nèi)容可以接受用戶的任何輸入。我們可以使用特殊的 safe 規(guī)則實(shí)現(xiàn)此目的:

array('content', 'safe')

為了完成起見,還有一個(gè)用于聲明一個(gè)屬性為不安全的 unsafe 規(guī)則:

array ('permission', 'unsafe')

unsafe 規(guī)則并不常用,它是我們之前定義的安全特性的一個(gè)例外 。

1.0 中的安全特性

在版本1.0中,決定一個(gè)數(shù)據(jù)項(xiàng)是否是安全的,基于一個(gè)名為 safeAttributes 方法的返回值 和數(shù)據(jù)項(xiàng)被指定的場(chǎng)景. 默認(rèn)的,這個(gè)方法返回所有公共成員變量作為 CFormModel 的安全特性,而它也返回了除了主鍵外, 表中 所有字段名作為 CActiveRecord的安全特性.我們可以根據(jù)場(chǎng)景重寫這個(gè)方法來限制安全特性 .例如, 一個(gè)用戶模型可以包含很 多特性,但是在 login 場(chǎng)景.里,我們只能使用 username 和 password 特性.我們可以按照如下來指定這一限制 :

public function safeAttributes()    
{    
    return array(    
        parent::safeAttributes(),    
        'login' => 'username, password',    
    );    
}safeAttributes 方法更準(zhǔn)確的返回值應(yīng)該是如下結(jié)構(gòu)的 :
array(    
   // these attributes can be massively assigned in any scenario    
   // that is not explicitly specified below    
   'attr1, attr2, ...',    
     *    
   // these attributes can be massively assigned only in scenario 1    
   'scenario1' => 'attr2, attr3, ...',    
     *    
   // these attributes can be massively assigned only in scenario 2    
   'scenario2' => 'attr1, attr3, ...',    
)

如果模型不是場(chǎng)景敏感的(比如,它只在一個(gè)場(chǎng)景中使用,或者所有場(chǎng)景共享了一套同樣的安全特性),返 回值可以是如 下那樣簡(jiǎn)單的字符串.

'attr1, attr2, ...'

而那些不安全的數(shù)據(jù)項(xiàng),我們需要使用獨(dú)立的賦值語(yǔ)句來分 配它們到相應(yīng)的特性.如下所示:

$model->permission='admin';    
$model->id=1;4. 觸發(fā)驗(yàn)證

一旦模型被用戶提交的數(shù)據(jù)填充,我們就可以調(diào)用 CModel::validate() 出發(fā) 數(shù)據(jù)驗(yàn)證進(jìn)程。此方法返回一個(gè)指示驗(yàn)證是否成功的值。 對(duì) CActiveRecord 模型來說,驗(yàn)證也可以在我們調(diào)用其 CActiveRecord::save() 方法時(shí)自動(dòng)觸發(fā)。

我們可以使用 scenario 設(shè)置場(chǎng)景屬性,這樣,相應(yīng)場(chǎng)景的驗(yàn)證規(guī)則就會(huì)被 應(yīng)用。

驗(yàn)證是基于場(chǎng)景執(zhí)行的。 scenario 屬性指定了模型當(dāng)前用于的場(chǎng)景和當(dāng)前使用的驗(yàn)證規(guī)則集。 例如,在 login 場(chǎng)景中,我們只想驗(yàn)證用戶模型中的 username 和 password 輸入; 而在 register 場(chǎng)景中,我們需要驗(yàn)證更多的輸入,例如 email, address, 等。 下面的例子演示了如何在 register 場(chǎng)景中執(zhí)行驗(yàn)證:

// 在注冊(cè)場(chǎng)景中創(chuàng)建一個(gè)  User 模型
。等價(jià)于:    
// $model=new User;    
// $model->scenario='register';    
$model=new User('register');    
        
// 將輸入的值填充到模型    
$model->attributes=$_POST['User'];    
        
// 執(zhí)行驗(yàn)證    
if($model->validate())   // if the inputs are valid    
    ...    
else
    ...規(guī)則關(guān)聯(lián)的場(chǎng)景可以通過規(guī)則中的 on 選項(xiàng)指定。如果 on 選項(xiàng)未設(shè)置,則此規(guī)則會(huì)應(yīng)用于所有場(chǎng)景。例如:
public function rules()    
{    
    return array(    
        array('username, password', 'required'),    
        array('password_repeat', 'required', 'on'=>'register'),    
        array('password', 'compare', 'on'=>'register'),    
    );    
}

第一個(gè)規(guī)則將應(yīng)用于所有場(chǎng)景,而第二個(gè)將只會(huì)應(yīng)用于 register 場(chǎng)景。

5. 提取驗(yàn)證錯(cuò)誤

驗(yàn)證完成 后,任何可能產(chǎn)生的錯(cuò)誤將被存儲(chǔ)在模型對(duì)象中。 我們可以通過調(diào)用 CModel::getErrors()和CModel::getError() 提取這些錯(cuò) 誤信息。 這兩個(gè)方法的不同點(diǎn)在于第一個(gè)方法將返回 所有 模型特性的錯(cuò)誤信息,而第二個(gè)將只返回 第一個(gè) 錯(cuò)誤信息。

6. 特性標(biāo)簽

當(dāng)設(shè)計(jì)表單時(shí),我們通常需要為每個(gè)表單域顯示一個(gè)標(biāo)簽。 標(biāo)簽告訴用戶他應(yīng)該在此表單域中填寫 什么樣的信息。雖然我們可以在視圖中硬編碼一個(gè)標(biāo)簽, 但如果我們?cè)谙鄳?yīng)的模型中指定(標(biāo)簽),則會(huì)更加靈活方便。

默認(rèn)情況下 CModel 將簡(jiǎn)單的返回特性的名字作為其標(biāo)簽。這可以通過覆蓋 attributeLabels() 方法自定義。 正如在 接下來的小節(jié)中我們將看到的,在模型中指定標(biāo)簽會(huì)使我們能夠更快的創(chuàng)建出更強(qiáng)大的表單。

7. 創(chuàng)建動(dòng)作Action方法

創(chuàng)建好LoginForm 表單Model后,我們就可以為它編寫用戶提交后的處理代碼(對(duì)應(yīng)到Controller中的某個(gè)Action方法) 。本例使用缺省的SiteController,對(duì)應(yīng)的action為actionLogin.

public function actionLogin()    
{    
    $model=new LoginForm;    
    // collect user input data    
    if(isset($_POST['LoginForm']))    
    {    
        $model->attributes=$_POST['LoginForm'];    
        // validate user input and redirect to the previous page if valid    
        if($model->validate() && $model->login()){    
        
            $this->render('index');    
            return;    
        }    
    }    
    // display the login form    
    $this->render('login',array('model'=>$model));    
}

如上所示,我們首先創(chuàng)建了一個(gè) LoginForm 模型示例; 如果請(qǐng)求是一個(gè) POST 請(qǐng)求(意味著這個(gè)登錄表單被提交了 ),我們則使用提交的數(shù)據(jù) $_POST['LoginForm'] 填充 $model ;然后我們驗(yàn)證此輸入,如果驗(yàn)證成功,則顯示index 頁(yè)面。 如果驗(yàn)證失敗,或者此動(dòng)作被初次訪問,我們則渲染 login 視圖。
注意的我們修改了SiteController 的缺省 action為login.

/**   
 * @var string sets the default action to be 'login'   
 */
public $defaultAction='login';

因此用戶見到的第一個(gè)頁(yè)面為login頁(yè)面而非index頁(yè)面,只有在用戶輸入正確的用 戶名,本例使用固定的用戶名和密碼,參見UserIdentity類定義,實(shí)際應(yīng)用可以讀取數(shù)據(jù)庫(kù)或是LDAP服務(wù)器。

/**   
 * UserIdentity represents the data needed to identity a user.   
 * It contains the authentication method that checks if the provided   
 * data can identity the user.   
 */
class UserIdentity extends CUserIdentity    
{    
    /**   
     * Authenticates a user.   
     * The example implementation makes sure if the username and password   
     * are both 'demo'.   
     * In practical applications, this should be changed to authenticate   
     * against some persistent user identity storage (e.g. database).   
     * @return boolean whether authentication succeeds.   
     */
    public function authenticate()    
    {    
        $users=array(    
            // username => password    
            'demo'=>'demo',    
            'admin'=>'admin',    
        );    
        if(!isset($users[$this->username]))    
            $this->errorCode=self::ERROR_USERNAME_INVALID;    
        else if($users[$this->username]!==$this->password)    
            $this->errorCode=self::ERROR_PASSWORD_INVALID;    
        else
            $this->errorCode=self::ERROR_NONE;    
        return !$this->errorCode;    
    }    
}

讓我們特別留意一下 login 動(dòng)作中出現(xiàn)的下面的 PHP 語(yǔ)句:

$model->attributes=$_POST ['LoginForm'];

正如我們?cè)?安全的特性賦值 中所講的, 這行代碼使用用戶提交的數(shù)據(jù)填充模型。 attributes 屬性由 CModel定義,它接受一個(gè)名值對(duì)數(shù)組并將其中的每個(gè)值賦給相應(yīng)的模型特性。 因此如果 $_POST ['LoginForm'] 給了我們這樣的一個(gè)數(shù)組,上面的那段代碼也就等同于下面冗長(zhǎng)的這段 (假設(shè)數(shù)組中存在所有所需的特 性):

$model->username=$_POST['LoginForm']['username'];
$model->password=$_POST ['LoginForm']['password'];
$model->rememberMe=$_POST['LoginForm'] ['rememberMe'];

8. 構(gòu)建視圖

編寫 login 視圖是很簡(jiǎn)單的,我們以一個(gè) form 標(biāo)記開始,它的 action 屬性應(yīng)該是前面講述的 login 動(dòng)作的URL。 然后我們需要為 LoginForm 類中聲明的屬性插入標(biāo)簽和表單域。最后, 我們插入 一個(gè)可由用戶點(diǎn)擊提交此表單的提交按鈕。所有這些都可以用純HTML代碼完成。

Yii 提供了幾個(gè)助手(helper)類簡(jiǎn)化 視圖編寫。例如, 要?jiǎng)?chuàng)建一個(gè)文本輸入域,我們可以調(diào)用 CHtml::textField(); 要?jiǎng)?chuàng)建一個(gè)下拉列表,則調(diào)用 CHtml::dropDownList()。

信息: 你可能想知道使用助手的好處,如果它們所需的代碼量和直接寫純HTML的代碼量相當(dāng)?shù)?話。 答案就是助手可以提供比 HTML 代碼更多的功能。例如, 如下代碼將生成一個(gè)文本輸入域,它可以在用戶修改了其值時(shí)觸 發(fā)表單提交動(dòng)作。

CHtml::textField($name,$value,array('submit'=>''));

不然的話你就 需要寫一大堆 JavaScript 。

下面,我們使用 CHtml 創(chuàng)建一個(gè)登錄表單。我們假設(shè)變量 $model 是 LoginForm 的實(shí)例 。

<center class="form">    
<?php echo CHtml::beginForm(); ?>    
    <?php echo CHtml::errorSummary($model); ?>
    <center class="row">
        <?php echo CHtml::activeLabel($model,&#39;username&#39;); ?>    
        <?php echo CHtml::activeTextField($model,&#39;username&#39;) ?>    
    </center>
    <center class="row">    
        <?php echo CHtml::activeLabel($model,&#39;password&#39;); ?>    
        <?php echo CHtml::activePasswordField($model,&#39;password&#39;) ?>    
    </center>
    <center class="row rememberMe">    
        <?php echo CHtml::activeCheckBox($model,&#39;rememberMe&#39;); ?>    
        <?php echo CHtml::activeLabel($model,&#39;rememberMe&#39;); ?>    
    </center>
    <center class="row submit">    
        <?php echo CHtml::submitButton(&#39;Login&#39;); ?>    
    </center>
<?php echo CHtml::endForm(); ?>    
</center><!-- form -->

上述代碼生成了一個(gè)更加動(dòng)態(tài)的表單,例如, CHtml::activeLabel() 生成一個(gè)與 指定模型的特性相關(guān)的標(biāo)簽。 如果此特性有一個(gè)輸入錯(cuò)誤,此標(biāo)簽的CSS class 將變?yōu)?error,通過 CSS 樣式改變了標(biāo)簽的外 觀。 相似的,CHtml::activeTextField() 為指定模型的特性生成一個(gè)文本輸入域,并會(huì)在錯(cuò)誤發(fā)生時(shí)改變它的 CSS class。

如果我們使用由 yiic 腳本生提供的 CSS 樣式文件,生成的表單就會(huì)像下面這樣:

PHP development framework Yii Framework tutorial (8) Using FormModel

CSS 樣式定義在css目錄下,本例使用的為Yii缺省的樣式。

從版本 1.1.1 開始,提供了一個(gè)新的小物件 CActiveForm 以簡(jiǎn)化表單創(chuàng)建。 這個(gè)小物件可同時(shí)提供客戶端及服務(wù)器端無(wú)縫的、一致的驗(yàn)證。使用 CActiveForm, 上面的代 碼可重寫為:

<center class="form">    
<?php $form=$this->beginWidget(&#39;CActiveForm&#39;); ?>    
         
    <?php echo $form->errorSummary($model); ?>    
         
    <center class="row">    
        <?php echo $form->label($model,&#39;username&#39;); ?>    
        <?php echo $form->textField($model,&#39;username&#39;) ?>    
    </center>    
         
    <center class="row">    
        <?php echo $form->label($model,&#39;password&#39;); ?>    
        <?php echo $form->passwordField($model,&#39;password&#39;) ?>    
    </center>    
         
    <center class="row rememberMe">    
        <?php echo $form->checkBox($model,&#39;rememberMe&#39;); ?>    
        <?php echo $form->label($model,&#39;rememberMe&#39;); ?>    
    </center>    
         
    <center class="row submit">    
        <?php echo CHtml::submitButton(&#39;Login&#39;); ?>    
    </center>    
         
<?php $this->endWidget(); ?>    
</center><!-- form -->

從下篇開始將逐個(gè)介紹Yii框架支持的UI組件包括CActiveForm的用法。

以上就是PHP開發(fā)框架Yii Framework教程(8) 使用FormModel的內(nèi)容,更多相關(guān)內(nèi)容請(qǐng)關(guān)注PHP中文網(wǎng)(miracleart.cn)!


Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undress AI Tool

Undress AI Tool

Undress images for free

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to identify Windows upgrade issues using SetupDiag on Windows 11/10 How to identify Windows upgrade issues using SetupDiag on Windows 11/10 Apr 17, 2023 am 10:07 AM

Whenever your Windows 11 or Windows 10 PC has an upgrade or update issue, you will usually see an error code indicating the actual reason behind the failure. However, sometimes confusion can arise when an upgrade or update fails without an error code being displayed. With handy error codes, you know exactly where the problem is so you can try to fix it. But since no error code appears, it becomes challenging to identify the issue and resolve it. This will take up a lot of your time to simply find out the reason behind the error. In this case, you can try using a dedicated tool called SetupDiag provided by Microsoft that helps you easily identify the real reason behind the error.

Microsoft NET Framework Installation Issues Error Code 0x800c0006 Fix Microsoft NET Framework Installation Issues Error Code 0x800c0006 Fix May 05, 2023 pm 04:01 PM

.NET Framework 4 is required by developers and end users to run the latest versions of applications on Windows. However, while downloading and installing .NET Framework 4, many users complained that the installer stopped midway, displaying the following error message - " .NET Framework 4 has not been installed because Download failed with error code 0x800c0006 ". If you are also experiencing it while installing .NETFramework4 on your device then you are at the right place

SCNotification has stopped working [5 steps to fix it] SCNotification has stopped working [5 steps to fix it] May 17, 2023 pm 09:35 PM

As a Windows user, you are likely to encounter SCNotification has stopped working error every time you start your computer. SCNotification.exe is a Microsoft system notification file that crashes every time you start your PC due to permission errors and network failures. This error is also known by its problematic event name. So you might not see this as SCNotification having stopped working, but as bug clr20r3. In this article, we will explore all the steps you need to take to fix SCNotification has stopped working so that it doesn’t bother you again. What is SCNotification.e

Microsoft .NET Framework 4.5.2, 4.6, and 4.6.1 will end support in April 2022 Microsoft .NET Framework 4.5.2, 4.6, and 4.6.1 will end support in April 2022 Apr 17, 2023 pm 02:25 PM

Microsoft Windows users who have installed Microsoft.NET version 4.5.2, 4.6, or 4.6.1 must install a newer version of the Microsoft Framework if they want Microsoft to support the framework through future product updates. According to Microsoft, all three frameworks will cease support on April 26, 2022. After the support date ends, the product will not receive "security fixes or technical support." Most home devices are kept up to date through Windows updates. These devices already have newer versions of frameworks installed, such as .NET Framework 4.8. Devices that are not updating automatically may

Yii2 vs Phalcon: Which framework is better for developing graphics rendering applications? Yii2 vs Phalcon: Which framework is better for developing graphics rendering applications? Jun 19, 2023 am 08:09 AM

In the current information age, big data, artificial intelligence, cloud computing and other technologies have become the focus of major enterprises. Among these technologies, graphics card rendering technology, as a high-performance graphics processing technology, has received more and more attention. Graphics card rendering technology is widely used in game development, film and television special effects, engineering modeling and other fields. For developers, choosing a framework that suits their projects is a very important decision. Among current languages, PHP is a very dynamic language. Some excellent PHP frameworks such as Yii2, Ph

KB5012643 for Windows 11 breaks .NET Framework 3.5 apps KB5012643 for Windows 11 breaks .NET Framework 3.5 apps May 09, 2023 pm 01:07 PM

It's been a week since we talked about the new safe mode bug affecting users who installed KB5012643 for Windows 11. This pesky issue didn't appear on the list of known issues Microsoft posted on launch day, thus catching everyone by surprise. Well, just when you thought things couldn't get any worse, Microsoft drops another bomb for users who have installed this cumulative update. Windows 11 Build 22000.652 causes more problems So the tech company is warning Windows 11 users that they may experience problems launching and using some .NET Framework 3.5 applications. Sound familiar? But please don't be surprised

Data query in Yii framework: access data efficiently Data query in Yii framework: access data efficiently Jun 21, 2023 am 11:22 AM

The Yii framework is an open source PHP Web application framework that provides numerous tools and components to simplify the process of Web application development, of which data query is one of the important components. In the Yii framework, we can use SQL-like syntax to access the database to query and manipulate data efficiently. The query builder of the Yii framework mainly includes the following types: ActiveRecord query, QueryBuilder query, command query and original SQL query

How to use Yii3 framework in php? How to use Yii3 framework in php? May 31, 2023 pm 10:42 PM

As the Internet continues to develop, the demand for web application development is also getting higher and higher. For developers, developing applications requires a stable, efficient, and powerful framework, which can improve development efficiency. Yii is a leading high-performance PHP framework that provides rich features and good performance. Yii3 is the next generation version of the Yii framework, which further optimizes performance and code quality based on Yii2. In this article, we will introduce how to use Yii3 framework to develop PHP applications.

See all articles