草庐IT

use-mirrors

全部标签

php - 身份验证组件 : Which pattern can I use? (PHP)

我正在尝试构建一个尽可能分离的身份验证组件,允许不同类型的身份验证(例如:http、摘要、数据库等),就像zend_auth:http://framework.zend.com/manual/en/zend.auth.html他们使用的模式有名字吗?你能推荐我一个不同的方法吗?也许是Bridge或Strategy模式? 最佳答案 根据您提供的链接:Zend_AuthprovidesanAPIforauthenticationandincludesconcreteauthenticationadaptersZend_auth本身就是S

php - 发送 : How to manage XML data where multiple elements have the same name using Zend_Config_Xml?

尝试使用Zend_Config_Xml从XML文件中提取数据,我正在寻找处理多个元素具有相同名称的数据的最佳方法。请看下面的例子。这是XML文件:example1.cssexample2.css代码如下:$data=newZend_Config_Xml('./path/to/xml_file.xml','stylesheets');$stylesheets=$data->stylesheet->toArray();我想做的是遍历$stylesheet使用foreach循环的数组,提取文件名,然后将样式表附加到headLink().这工作正常...但是,当的数量时,我遇到了问题元素小于2

PHP 继承 : child class overriding parent variable/property for use in constructor

我有一个(抽象的)父类应该在构造期间提供功能。子类可以覆盖构造函数中使用的属性:classParentextendsMiddlewareTest{//abstractchannelpropertiesprotected$title=NULL;protected$type=NULL;protected$resolution=NULL;function__construct(){parent::__construct();$this->uuid=$this->createChannel($this->title,$this->type,$this->resolution);}}classC

php - 错误 : You must use the "set" method to update an entry fix?

我使用codeigniter作为我的PHP框架,当我提交我的fromtopost到我的数据库时,我总是收到这个错误。Youmustusethe"set"methodtoupdateanentry我不太确定这是什么意思,从我看过的其他帖子来看,每个人都说数据映射器需要为对象分配一个值。由于我是新手,有人可以给我更好的解释吗。这是我的代码,它说我有错误:classAdd_bookextendsCI_Model{publicfunctionadd_book($data){$this->db->insert('ST_ITM',$data);}}?>谢谢。 最佳答案

php - 电报机器人 : using offset in getUpdates method

我想为提要订阅构建一个电报机器人,这样订阅者就可以获取站点更新。但我需要用户开始与我的机器人聊天。我将根据这个url使用深度链接:https://core.telegram.org/bots#deep-linking(假设有2个用户)向用户#2显示以下链接https://telegram.me/MyBot?start=$unique_code用户#2点击链接并开始与机器人聊天。用户#2返回我的网站并点击检查按钮。网站发出getUpdates请求并找到与用户的unique_code关联的chat_id。偏移量将增加1。现在有一个问题。当offset增加时,用户#1在用户#2之前开始与bo

php - fatal error : Out of memory (allocated 1979711488) (tried to allocate 131072 bytes) error occur while writing xlsx file using phpexcel

我已经集成了xlsx文件,用于使用phpexcel从数据库写入。我想在xlsx文件中写入3,00,000条记录。但直到通过Fatalerror:Outofmemory(allocated1979711488)(triedtoallocate131072bytes)我的PHP版本5.3.28我还设置了phpini和单元格缓存,请参阅下面的代码ini_set('max_execution_time',-1);ini_set('memory_limit','-1');$cacheMethod=PHPExcel_CachedObjectStorageFactory::cache_in_memo

PHP MVC : use router inside controller?

我正在构建自己的MVC框架(以改进我的PHP),但我不知道如何处理好的做法。在我的路由器中,我有一个使用路由名称和参数创建链接的方法(该方法返回格式正确的url),因此在我的Controller中,我可以使用如下内容://insideanactionofanyofmycontrollers$router=Router::getInstance();//therouterisaSingleton$url=$router->createUrl('articleReadOne',array(65,'matrix'));//$url="article/read/65-matrix"$this-

php - 创建资源 : [message] fopen(): Unable to find the wrapper "https" on Ubuntu using Symfony 时出错

我正在尝试在Ubuntu17.04机器上安装Symfony3,但出现错误:[GuzzleHttp\Ring\Exception\RingException]Errorcreatingresource:[message]fopen():Unabletofindthewrapper"https"-didyouforgettoenableitwhenyouconfiguredPHP?[file]phar:///usr/local/bin/symfony/vendor/guzzlehttp/ringphp/src/Client/StreamHandler.php[line]406[messag

php - 变量类名忽略 "use"

从其他帖子看来,如果您定义了namespace并希望在另一个namespace中动态创建对象,则必须构造一个字符串并在新调用中使用它。但是,我的行为很奇怪。看来此方法无法跨namespace工作。用户.php:namespaceapplication\models;classUser{publicfunctionhello(){echo"HellofromUser!";}}Controller.php:namespaceapplication\controllers;useapplication\models;require('User.php');$userStr='models\\

php - 在 php 中使用 session.use_cookies

如果我将session.use_cookies的值更改为true或false,我已经四处寻找对phpsession的影响,但是有似乎对它的工作方式没有影响。session.use_cookies在php中有什么用,为什么需要它? 最佳答案 这是您希望在客户端管理您的sessionID的方式,如果设置(默认)sessionID将存储在cookie中,否则它将作为GET变量在url中传递。 关于php-在php中使用session.use_cookies,我们在StackOverflow上找