Home > Backend Development > PHP Tutorial > Thinkphp S function has problems using phpredis

Thinkphp S function has problems using phpredis

WBOY
Release: 2016-07-06 13:52:47
Original
1175 people have browsed it

<code>    public function test3()
        {
                $a=S(array(
                'type' => 'redis',
                'prefix' => 'think',
                'expire' => 3600)
                );

                // 设置缓存
           echo S('name', "1111");   //返回值是1
        
    }

    public function test4(){
       echo  $value = S("name");    //什么不输出 dump的话输出false
    }</code>
Copy after login
Copy after login

Reply content:

<code>    public function test3()
        {
                $a=S(array(
                'type' => 'redis',
                'prefix' => 'think',
                'expire' => 3600)
                );

                // 设置缓存
           echo S('name', "1111");   //返回值是1
        
    }

    public function test4(){
       echo  $value = S("name");    //什么不输出 dump的话输出false
    }</code>
Copy after login
Copy after login

<code class="php">
S('name', "1111", ['type' => 'redis',
                'prefix' => 'think',
                'expire' => 3600]);
</code>
Copy after login
<code class="php">
/**
 * 缓存管理
 * @param mixed $name 缓存名称,如果为数组表示进行缓存设置
 * @param mixed $value 缓存值
 * @param mixed $options 缓存参数
 * @return mixed
 */
function S($name, $value = '', $options = null)</code>
Copy after login

<code>S('name', 1111);   // 返回的是这个操作的状态值,如果操作成功就是返回的true,反之返回的时候false;所以echo 1部队吗?
为什么不echo S('name')?;</code>
Copy after login
Related labels:
source:php.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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template