草庐IT

private_function

全部标签

php - 如何在 Yahoo PHP5 Sdk yos-social-php5 上使用 YQL 获取私有(private)数据

我正在使用YahooPHP5SDK并使用它从表social.contacts中获取用户联系人,这是一个私有(private)数据。在Delicious的示例中,它仅显示从YQL获取公共(public)数据。我可以知道我应该使用什么参数来使用YahooYQLQuery和Execute()类获取私有(private)数据吗?我尝试按照示例进行操作,但出现以下错误消息:YQLqueryfailedwitherror:"AuthenticationError.Thetablesocial.contactsrequiresahighersecuritylevelthanisprovided,yo

php - 使用 gzopen() : undefined function 时出现 fatal error

我想使用gzopen函数打开一个.gz文件,但出现了这个错误:Fatalerror:Calltoundefinedfunctiongzopen()这里是关于我的安装的一些细节:OS:Ubuntu10.04uptodateApacheversion:2.2.14PHP:5.2.10-2ubuntu6在phpinfo()的Zlib部分,我得到了这个:ZLibSupportenabledStreamWrappersupportcompress.zlib://StreamFiltersupportzlib.inflate,zlib.deflateCompiledVersion1.2.3.3Li

php - 工厂方法和私有(private)变量

我正在使用一个工厂类来创建另一个类的实例,比如Product类。如何在工厂类的Product类中设置私有(private)变量?我应该这样做吗?我打算做的是公开setter方法,然后在完成后卡住或锁定实例。但我觉得这是错误的做事方式。你会如何处理这样的问题?编辑:是的,我想使用@derekerdmann的不可变对象(immutable对象)方法。但我可能应该先提供更多信息。我正在用php为类似HTML的语言编写一个解析器,这样您就可以获得节点,而节点又可以包含其他节点。所以工厂是一个生成节点层次结构的解析器。如果你好奇这里是代码http://http://bazaar.launchpa

php - 在 5.3 之前的 PHP 中使用 "create_function"比较器进行排序?

我以前从未在PHP中使用过匿名函数,但我发现了一段使用匿名函数对对象进行排序的代码usort($numTurnsPerUser,build_sorter('turns'));functionbuild_sorter($key){returnfunction($a,$b)use($key){returnstrnatcmp($a[$key],$b[$key]);};}此代码将按键对对象进行排序(我传入“turns”)。例如,一个看起来像这样的对象:(用JSON编写,只是为了便于阅读)$numTurnsPerUser={"31":{"turns":15,"order":0},"36":{"t

php - 为什么 PHP 允许从其他实例调用私有(private)方法?

PHP允许调用私有(private)方法,只要它们来自同一类的实例。这就是thePHPdocs解释一下:Objectsofthesametypewillhaveaccesstoeachothersprivateandprotectedmemberseventhoughtheyarenotthesameinstances.Thisisbecausetheimplementationspecificdetailsarealreadyknownwheninsidethoseobjects.这不会破坏封装吗?实现的具体细节是已知的这一事实如何证明它的合理性?附注是否有其他(面向对象的)语言可以

php - 将 Composer 与私有(private) VCS 一起使用时,它会无限请求授权

在我的composer.json中,我有一个私有(private)的vcs存储库:{"type":"vcs","url":"https://github.com/username/repo.git"}当我调用phpcomposer.pharupdate时,我得到以下信息:YourGitHubcredentialsarerequiredtofetchprivaterepositorymetadata(https://github.com/username/repo.git)ThecredentialswillbeswappedforanOAuthtokenstoredin/root/.c

PHP/MySQLi - fatal error : Call to a member function mysqli_query() on a non-object

这是我的代码:require"../include/functions.php";error_reporting(E_ALL);ini_set('display_errors','1');ConnectWithMySQLiDatabase();$Cat=addslashes($_POST["Category"]);$v=$conn->mysqli_query($conn,"SELECT*FROM`categories`WHERE`id`=$Cat");$vrowi=mysqli_fetch_array($v,MYSQLI_ASSOC);$url=$conn->real_escape_s

php - 如何通过 Web 套接字将私有(private)数据安全地发送到 Objective-C 客户端并返回到服务器?

我正在建立到ratchet的wss://连接(一个PHP套接字库)使用SocketRocket(一个Objective-c套接字库)。我计划通过此套接字连接发送私有(private)数据,然后使用https://请求将数据发送回服务器。Objective-C代码://initiateglobalvariable@property(nonatomic)NSMutableArray*keys;...//receivetheprivatedatawithSocketRocket-(void)webSocket:(SRWebSocket*)webSocketdidReceiveMessage:

php - 在 PHP 中,max_execution_time 会影响通过 register_shutdown_function() 调用运行的关闭函数吗?

我有一个使用register_shutdown_function()注册的关闭函数,需要很长时间才能完成。PHP的max_execution_time会导致PHP终止此函数还是会一直运行直到完成或出错? 最佳答案 它将运行完成。http://us2.php.net/manual/en/function.register-shutdown-function.php#33575 关于php-在PHP中,max_execution_time会影响通过register_shutdown_func

php - fatal error : Call to a member function

我需要帮助来调试我的代码。我是php的新手,目前正在使用codeigniter框架。我试图将我的数据库表的内容显示到我的页面/controllers/users.php$load->model('Users');}functionindex(){$data['users']=$this->Users->getUsersWhere('useridUsers->getNumUsers();$data['title']='Displayinguserdata';$data['header']='UserList';//load'users_view'view$this->load->view