草庐IT

result_dir

全部标签

php xpath : query within a query result

我正在尝试解析一个html文件。想法是使用title和desc类获取跨度,并在每个具有属性class='thebest'的div中获取它们的信息。这是我的代码:testmoshe1haimmoshe2moshe3title1desc1spanclass="title">title2desc2KFIR;$doc=newDOMDocument();@$doc->loadHTML($example);$xpath=newDOMXPath($doc);$expression="//div[@class='thebest']";$arts=$xpath->query($expression);f

php - $mysqli->fetch_object($result) 不工作

我正在学习mysqli。我正在尝试从表“tbllogin”中获取数据。//DATABASECONNECTION$hostname="p:localhost";$database="dbLogin";$username="user1";$password="pwd1";$mysqli=newmysqli($hostname,$username,$password,$database);if(mysqli_connect_errno()){echomysqli_connect_error();}//CreateQuery$query="SELECT*FROMtbllogin";//Esca

php - Vagrant/Puppet --- 确保 : change from present failed: Could not set 'present on ensure: No such file or dir

我正在使用Vagrant和Puppet在Ubuntu上安装Apache和PHP。但是,我在vagrantup期间收到以下错误。我认为模板的路径是正确的,那为什么会出错呢?我正在使用设置here修改以确保apt-getupdate在任何其他操作之前运行错误←[1;35merr:/Stage[main]/Php/File[/etc/php5/apache2/apc.ini]/ensure:从缺席出席失败:无法设置“出席确保:没有这样的文件或目录ectory-/etc/php5/apache2/apc.ini.puppettmp_6187在/tmp/vagrant-puppet/module

php - Count Doctrine 的 iterate() Collection Result

有一个QueryBuilder结果$query=$em->createQuery("SELECT....");通过iterate()方法获取它们http://doctrine-orm.readthedocs.org/en/2.0.x/reference/batch-processing.html$objects=$query->iterate();我现在可以foreach($objectsas$object){$object=$object[0];//dosomething..$object->getObjectId();...}但是...//aftertheiterate()call

php - 谷歌搜索 : Scrape results page in PHP for total results

是否可以使用PHP抓取Google搜索结果页面以提取找到的搜索结果总数?如果是这样,我该怎么做呢?谢谢 最佳答案 尝试使用phpsimplehtmlparser$search_query='google';$url=sprintf('http://www.google.com/search?q=%s',$search_query);$html=file_get_html($url);$results=$html->find('#resultStats/b',2)->innertext;echosprintf('Googlefound

apache - 无法设置 php_value 'soap.wsdl_cache_dir'

我有运行Apache2.2.4和PHP-FPM(FastCGI进程管理器)的VPS服务器(CentOS6.5)。查看php-fpmerror_log我注意到每个spawnphp-fpm子进程都有错误:WARNING:[poolwww]child24086saidintostderr:"ERROR:Unabletosetphp_value'soap.wsdl_cache_dir'"我无法通过谷歌搜索找到有关此警告的任何信息。有人知道这是什么意思以及如何摆脱这个警告吗?更新1:apache的fastcgi.conf:UserapacheGroupapacheLoadModulefastcg

php - 给出警告 : mysql_result() expects parameter 1 to be resource, bool 值

我知道我们已经有很多关于这个错误的问题,但我无法修复我的代码,所以这里的任何人都请帮助我解决这个问题。我的代码是这样的functionlogin($username,$password){$user_id=user_id_from_username($username);$username=sanitize($username);$password=md5($password);return(mysql_result(mysql_query("SELECTCOUNT(`user_id`)FROM`users`WHERE`username`='$username'AND`password

PHP 字符串比较 : odd result, 可能的类型杂耍,不知道为什么

我知道数字字符串可能在PHP中被打乱类型,但我不明白为什么它会在这里发生或给出这个结果:$a="00010010001101000000101";$b="00010010001101000000001";$c=(($a==$b)?"true":"false");$d=(($a===$b)?"true":"false");echo$c."".$d."\n";//truefalse但在这种情况下,$a和$b的定义方式相同,长度相同,但内容不同,其中有许多字符。如何($a==$b)评估为真? 最佳答案 这是一个错误。在http://3v4

php - pg_free_result() 是否必要,即使结果超出范围?

PHP文档对pg_free_result()有这样的说法:Thisfunctionneedonlybecalledifmemoryconsumptionduringscriptexecutionisaproblem.Otherwise,allresultmemorywillbeautomaticallyfreedwhenthescriptends.http://www.php.net/manual/en/function.pg-free-result.php我会(也许天真地)期望通过调用pg_query()返回的资源在超出范围时被垃圾回收。在这样的假设函数中:functionselec

PHP AWS DynamoDB : Limit the Number of Total Query Results Using an Iterator

我正在尝试将迭代器返回的结果总数限制为3。而不是每次迭代的结果数。我希望使这个数字动态化。但是,我找不到任何真正的答案来完成这个,而且AWS提供的文档也没有帮助。将Limit与表名和键放在数组中不会限制结果。我也把它放在它自己的单独数组中,但这也不起作用。以下是我尝试过的方法,但我无法使其正常工作。任何帮助将不胜感激。$iterator=$dbh->getIterator('Query',array('TableName'=>'raw','KeyConditions'=>array('deviceID'=>array('AttributeValueList'=>array(array(