memcache

#1 bilwy

config.php 增加配置(其它地方均未做任何改动)
'launch' => array(
      'function_access' => array(
          array("spAccessCache", "memcache"),
       ),
  ),
  
  'ext' => array(
       'spAccessCache' => array(
             'memcache_host' => 'localhost', // memcache服务器地址
             'memcache_port' => '11211', // memcache服务器端口
        ),
   ),

能过spAccess调用,可以正常工作,但在memcache 服务器是没有相关记录.
stats items
END

通过非speedphp框架 自写程序测试
$mem = new Memcache;
$mem->connect('localhost', 11211);
$mem->set('var_key', 'This is a memcached test!',MEMCACHE_COMPRESSED, 60);
echo $mem->get('var_key');
?>
可以正常使用Memcache服务器
求解?

2014-02-21 15:54:34

#2 jake

请检查程序代码。

PS:spAccess的memcache驱动正常,没发现有报告代码问题。

2014-02-21 16:51:01

#3 bilwy

可是spAccess并没有使用memcache服务器,为何呢?如果验证使用了memcache服务器,
将'memcache_port' => '11211'修改成11222;
同样不报错,

2014-02-21 17:09:14

#4 jake

bilwy 发表于 2014-2-21 17:09
可是spAccess并没有使用memcache服务器,为何呢?如果验证使用了memcache服务器,
将'memcache_port' => '1121 ...
spAccess没有使用memcache,所以需要你检查自己的代码。

比如说配置放错位置也是不行的,

dump一下你的 $GLOBALS['G_SP'] 变量出来看看?

2014-02-21 17:54:25

#5 bilwy

    public function servpro(){
        $$$$$$$$$$$$$$$$pre_data = array( 200, 'i am string! ok' ); // 一个数组
        // 保存该数组为my_data,生存时间为一个小时
        spAccess('w' , 'my_data1', $$$$$$$$$$$$$$$$pre_data, 3600);
        // 将my_data获取到$$$$$$$$$$$$$$$$now_data中
        $$$$$$$$$$$$$$$$now_data = spAccess('r' , 'my_data1');
        dump($$$$$$$$$$$$$$$$now_data);
        dump($$$$$$$$$$$$$$$$GLOBALS['G_SP']);
    }
输出结果:如下

2014-02-21 21:40:27

#6 bilwy

    public function servpro(){
        $$pre_data = array( 200, 'i am string! ok' );

        spAccess('w' , 'my_data1', $$pre_data, 3600);

        $$now_data = spAccess('r' , 'my_data1');
        dump($$now_data);
        dump($$GLOBALS['G_SP']);
    }

2014-02-21 21:41:24

#7 bilwy

    public function servpro(){
        $pre_data = array( 200, 'i am string! ok' );

        spAccess('w' , 'my_data1', $pre_data, 3600);

        $now_data = spAccess('r' , 'my_data1');
        dump($now_data);
        dump($GLOBALS['G_SP']);
    }
上面显示乱码结果如下:
Array
(
    [0] => 200
    [1] => i am string! ok
)

    [launch] => Array
        (
            [router_prefilter] => Array
                (
                    [0] => Array
                        (
                            [0] => spAcl
                            [1] => maxcheck
                        )

                )

            [function_access] => Array
                (
                    [0] => Array
                        (
                            [0] => spAccessCache
                            [1] => memcache
                        )

                )

        )

    [auto_load_controller] => Array
        (
            [0] => spArgs
        )
*****



    [ext] => Array
        (
            [spAccessCache] => Array
                (
                    [memcache_host] => localhost
                    [memcache_port] => 11211
                )

            [spAcl] => Array
                (
                    [prompt] => Array
                        (
                            [0] => lib_sysuser
                            [1] => acljump
                        )

                )

        )


)

2014-02-21 21:46:08

#8 bilwy

index.php
// 载入配置与定义文件
require("config.php");
// 当前模块附加的配置
$spConfig['controller_path'] = APP_PATH.'/controller/'.basename(__FILE__,".php");
// 载入SpeedPHP框架
require(SP_PATH."/SpeedPHP.php");
spRun();
?>
config.php
// 定义当前目录
define("APP_PATH",dirname(__FILE__));
// 定义框架目录
define("SP_PATH",APP_PATH."/SpeedPHP");
// 默认时区设置
@date_default_timezone_set('PRC');
// 通用的全局配置
$spConfig = array(
        "db" => array(
                'host' => 'localhost',
                'login' => 'root',
                'password' => 'root',
                'database' => 'rootroot',
                'prefix' => 'sp_',
        ),
       
        'include_path'=>array(
                APP_PATH.'/plug',
        ),
   
        'view' => array(
                'enabled' => TRUE, // 开启视图
                'config' =>array(
                        'template_dir' => APP_PATH.'/template', // 模板目录
                        'compile_dir' => APP_PATH.'/tmp', // 编译目录
                        'cache_dir' => APP_PATH.'/tmp', // 缓存目录
                        'left_delimiter' => '<{',  // smarty左限定符
                        'right_delimiter' => '}>', // smarty右限定符
                ),
        ),
       
        'launch' => array(
      'router_prefilter' => array(
        array('spAcl','maxcheck'), // 开启强制的权限控制

        ),

      'function_access' => array(
            array("spAccessCache", "memcache"),
         ),
  ),
  
  'ext' => array(
       'spAccessCache' => array(
             'memcache_host' => 'localhost', // memcache服务器地址
             'memcache_port' => '11211', // memcache服务器端口
        ),
        'spAcl' => array( // acl扩展设置                 
        // 在acl中,设置无权限执行将lib_admin类的acljump函数
        'prompt' => array("lib_sysuser", "acljump"),
        ),

   ),
);
spConfig.php中的
'sp_cache' => APP_PATH.'/tmp',

2014-02-21 21:54:02

#9 jake

没看出来有什么异常的。

2014-02-22 16:25:29

#10 bilwy

找到问题所在了,感谢jake,是3.0.73 版本 spAccessCache 有问题;
3.1.89版本spUrlRewrite.php 加密了.不知道有什么更新没,
3.0.73版本的spUrlRewrite.php存在的问题也不知道新版本里还有没有,希望有机会可以学习学习

2014-02-23 01:50:37

#11 jake

bilwy 发表于 2014-2-23 01:50
找到问题所在了,感谢jake,是3.0.73 版本 spAccessCache 有问题;
3.1.89版本spUrlRewrite.php 加密了.不知道 ...
加密是什么? 目前框架最新版本是3.1.89,开源的。

最好是从本站下载框架文件 http://www.speedphp.com/thread-3879-1-8.html

2014-02-23 16:40:02

#12 bilwy

spUrlRewrite.php 我就是从本站下载的 自己再编译的文件

2014-02-23 17:19:24

#13 拓文

bilwy 发表于 2014-2-23 17:19
spUrlRewrite.php 我就是从本站下载的 自己再编译的文件
php 怎样编译?求指导。

2014-02-23 23:14:30

#14 bilwy

我在官网下载的3.1.89 UTF8 版本 spUrlRewrite.php 是已经编译过的 不知道大家是不是这样?

2014-02-24 09:17:36

#15 jake

bilwy 发表于 2014-2-24 09:17
我在官网下载的3.1.89 UTF8 版本 spUrlRewrite.php 是已经编译过的 不知道大家是不是这样? ...
SpeedPHP官网,也就是本站,下载的框架文件,是绝对没有所谓的“编译过”的PHP文件,请自行检查!

下载地址:http://www.speedphp.com/thread-3879-1-8.html

spUrlRewrite.php文件是这样的内容 https://git.oschina.net/SpeedPHP/framework/blob/master/SpeedPHP/Extensions/spUrlRewrite.php

请查证你所说的“官网”是什么样的网站吧,谢谢了。

2014-02-24 09:31:53

#16 jake

拓文 发表于 2014-2-23 23:14
php 怎样编译?求指导。
PHP的编译,是一种存在于内存里面的OPCODE二进制文件,这种文件只是内存的运行体,没有实际能存储到硬盘的文件的。所以PHP没有办法拿到编译后的文件。所以楼上那个应该是用错编辑器打开乱码,误以为是编译后的文件。

2014-02-24 09:34:10

#17 bilwy

jake 发表于 2014-2-24 09:31
SpeedPHP官网,也就是本站,下载的框架文件,是绝对没有所谓的“编译过”的PHP文件,请自行检查!

下载 ...
我是从http://www.speedphp.com/thread-3879-1-8.html上下载的UTF-8版本
‎spUrlRewrite.php 文件 修改时间:2013‎年‎8‎月‎16‎日,‏‎9:02:04
我打开的就是乱码 不知道什么情况

2014-02-24 09:41:56

#18 bilwy

其它的php都没有问题

2014-02-24 09:43:01

#19 jake

bilwy 发表于 2014-2-24 09:41
我是从http://www.speedphp.com/thread-3879-1-8.html上下载的UTF-8版本
‎spUrlRewrite.php 文件 修改 ...
我也刚下个回来看看,没有任何问题。建议你换个编辑器,比如说notepad++或者sublime text

QQ截图20140224104519.jpg



2014-02-24 10:38:05

#20 bilwy

确实是该死的编辑器问题  非常感谢 jake

2014-02-24 17:11:39