Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the common calling skills in Yii programming development

2025-04-13 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

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!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 264

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report