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

Thinkphp S function has problems using phpredis

WBOY
WBOYOriginal
2016-07-06 13:52:471181browse

<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>

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>

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

<code>S('name', 1111);   // 返回的是这个操作的状态值,如果操作成功就是返回的true,反之返回的时候false;所以echo 1部队吗?
为什么不echo S('name')?;</code>
Statement:
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