Get the App
SLTechnology News&Howtos  ›  Development  › 

PHP implements code sharing that COOKIE takes effect in time

Shulou Source: shulou.com Published: 2022-06-03 15:43:48 11月14日 Update

This article mainly explains "PHP to achieve COOKIE timely code sharing", the content of the article is simple and clear, easy to learn and understand, the following please follow the editor's ideas slowly in depth, together to study and learn "PHP COOKIE timely effective code sharing" bar!

The copy code is as follows:

/ * * set cookie * @ param string $name key name * @ param mixed $value value * @ param int $expire expiration time. Default is one day * / public final function setCookie ($name, $value, $expire = null) {/ / cookie value is empty, exit if (empty ($value) return; / / expiration time if (empty ($expire)) $expire = time () + 86400; $_ COOKIE [$name] = $cookie / / determine whether value is an array if (is_array ($value)) {foreach ($value as $k = > $v) {if (empty ($v)) continue; setcookie ($name. "[$k]", $v, $expire);}} else {setcookie ($name, $value, $expire);}} Thank you for reading, the above is the content of "PHP to achieve COOKIE timely effective code sharing". After the study of this article, I believe you have a deeper understanding of the problem that PHP implements COOKIE code sharing in a timely manner, and the specific use needs to be verified by practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Tags: Code learning content time that is ideas situations arrays articles more knowledge knowledge points articles follow questions practice push research verification Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Linux Xiaomi vpn OPPO Reno Huawei