解决php7.1的中遇到的问题

在php7.1中部署微擎遇到问题
1.mysql_xxx函数不支持,修改install.php为mysqli的写法

2.session读取失败,不是php.ini设置的问题,应该是php7.1的bug ,最终配置 memcache实现。

public static function start($uniacid, $openid, $expire = 3600) {
		if (empty($GLOBALS['_W']['config']['setting']['memcache']['session']) || empty($GLOBALS['_W']['config']['setting']['memcache']['server'])) {
			WeSession::$uniacid = $uniacid;
			WeSession::$openid = $openid;
			WeSession::$expire = $expire;
			$sess = new WeSession();
			session_set_save_handler(
				array(&$sess, 'open'),
				array(&$sess, 'close'),
				array(&$sess, 'read'),
				array(&$sess, 'write'),
				array(&$sess, 'destroy'),
				array(&$sess, 'gc')
			);
			register_shutdown_function('session_write_close');
		}

		session_start();
	}

3.一个curl的上传选项报警

$ch = curl_init();
		// if (ver_compare(phpversion(), '5.6') >= 0) {
		// 	curl_setopt($ch, CURLOPT_SAFE_UPLOAD, false);
		// }
		if (class_exists('\CURLFile')) {// 这里用特性检测判断php版本
            curl_setopt($ch, CURLOPT_SAFE_UPLOAD, true);
               $data = array('file' => new \CURLFile(realpath($source)));//>=5.5
        } else {
            if (defined('CURLOPT_SAFE_UPLOAD')) {
                curl_setopt($ch, CURLOPT_SAFE_UPLOAD, false);
            }
            $data = array('file' => '@' . realpath($source));//<=5.5
        }
posted @ 2017-04-27 20:47  天行侠  阅读(1117)  评论(0编辑  收藏  举报