Get the App
SLTechnology News&Howtos  ›  Development  › 

What are the common calling skills in Yii programming development

Shulou Source: shulou.com Published: 2022-06-03 12:58:01 09月11日 Update

This article mainly introduces the common invocation skills of Yii programming development. It is very detailed and has a certain reference value. Friends who are interested must finish reading it.

1. Set up the cookie:

$cookie = new CHttpCookie ('mycookie','this is mycookie'); $cookie- > expire = time () + 60 days, 60 days, 24 days, 30 days Yii::app ()-> request- > cookies [' mycookie'] = $cookie

two。 Read cookie:

$cookie = Yii::app ()-> request- > getCookies (); echo $cookie ['mycookie']-> value

3. Destroy cookie:

$cookie = Yii::app ()-> request- > getCookies (); unset ($cookie [$name])

4. Get updated data id

$post- > save (); $id = $post- > attributes ['id']

5. Get the inserted data id

$id = Yii::app ()-> db- > getLastInsertID ()

6. Get the data from get,post

Yii::app ()-> request- > getParam ('id')

7. Get the ip address

Yii::app ()-> request- > userHostAddress

8. Get the url of the previous page to return

Yii::app ()-> request- > urlReferrer

9. Get the current url:

Yii::app ()-> request- > url

10. Get the current home url:

Yii::app ()-> homeUrl

11. Get the current return url:

Yii::app ()-> user- > returnUrl

twelve。 Project path:

Dirname (Yii::app ()-> BasePath)

13. Project catalog:

Yii::app ()-> request- > baseUrl

14. Get the ID method of the current controller in view:

Yii::app ()-> request- > baseUrl

15. Get the ID method of the current action in view:

Yii::app ()-> getController ()-> getAction ()-> id

16. Yii determines the submission method:

Yii::app ()-> request- > isPostRequest

17. Get the current domain name:

Yii::app ()-> request- > hostInfo

18. Get the physical path to the proteced directory:

YII::app ()-> basePath; is all the contents of this article entitled "what are the common invocation techniques in Yii programming development?" Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Tags: Data common skill development programming content method directory article path project value interest address domain name partner way more limited Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Docker Microsoft vpn macOS Huawei