草庐IT

a_function_that_may_fail

全部标签

php - preg_match() [function.preg-match] : Unknown modifier

很难说出这里要问什么。这个问题模棱两可、含糊不清、不完整、过于宽泛或夸夸其谈,无法以目前的形式得到合理的回答。如需帮助澄清此问题以便重新打开,visitthehelpcenter.关闭10年前。我收到此错误消息:preg_match()[function.preg-match]:Unknownmodifier'='in/home/public_html/checkem.phponline13当我转到以下行时,我得到了这个:我已将ereg更改为preg_match然后用//包装代码,因为ereg出现了作为弃用。我仍然是编码的初学者,非常感谢任何帮助。

php - 第 332 行的 fatal error : Call to a member function getId() on a non-object in C:\wamp\www\magentno\lib\Varien\Data\Tree\Dbp. php

我正在使用Magento1.8.0.0,我通过本地主机在WAMP服务器上安装了一个测试版本,当我想添加类别时,出现下一个错误:fatalerror:在C:\wamp\www\magentno\lib\Varien\Data\Tree\Dbp.php中的非对象上调用成员函数getId()第332行我还没有开店,因为我需要那个类别。我已经在出现错误的行中添加了tryandcatch代码。这是给出错误的代码:publicfunctionloadEnsuredNodes($category,$rootNode){$pathIds=$category->getPathIds();$rootNod

php - 文件获取内容(): Failed to enable crypto

当我尝试从谷歌获取图片时,它为一次搜索提供了4张图片,但由于图片大小,我无法获取一些图片。这样我就会收到类似的错误"file_get_contents():Failedtoenablecrypto"有什么解决办法吗?这是我的代码all();$sql_2="TRUNCATE`tn_gift_google_image`";$query_1=Yii::$app->db->createCommand($sql_2)->execute();functionget_url_contents($url){$crl=curl_init();curl_setopt($crl,CURLOPT_USERAG

PHP 警告 : stream_socket_client(): Failed to enable crypto?

我正在使用swiftMailer直接使用SMTP发送电子邮件。我收到这个奇怪的错误:2011/09/2317:59:01[error]489#0:*1032FastCGIsentinstderr:"PHPWarning:stream_socket_client():SSLoperationfailedwithcode1.OpenSSLErrormessages:error:140770FC:SSLroutines:func(119):reason(252)in/home/nginx/websites/example.com/www/inc/lib/swift-mailer/lib/cl

PhpMyAdmin The session id is too long and Session object destruction failed 警告消息

以下是完整的警告信息:Warningin.\libraries\session.inc.php#101session_start():Thesessionidistoolongorcontainsillegalcharacters,validcharactersarea-z,A-Z,0-9and'-,'Backtrace.\libraries\session.inc.php#101:session_start().\libraries\common.inc.php#352:require(.\libraries\session.inc.php).\index.php#12:requir

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 Xpath : Get all href's that contain "letter"

假设我有一个已加载的html文件,我运行此查询:$url='http://www.fangraphs.com/players.aspx';$html=file_get_contents($url);$myDom=newDOMDocument;$myDom->formatOutput=true;@$myDom->loadHTML($html);$anchor=$xpath->query('//a[contains(@href,"letter")]');这给了我这些anchor的列表,如下所示:Aa但我需要一种方法来只获取“players.aspx?letter=Aa”。我想我可以试试:$

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

PHPUnit 和抽象类 : how to test concrete constructor that accepts parameters and other concrete methods

我有一个非常简单的类,如下所示:abstractclassPerson{private$id;private$createdOn;//...Moreprivatepropertiesprotected$unfound=array();构造函数对传递的数组$data执行foreach,并使用正确的方法为属性赋值。如果该方法不存在,则将key添加到protected数组中以保留它的踪迹(我将其称为$unfound,只是为了保持原样!)。publicfunction__construct($data){foreach($dataas$field=>$value){$method='set'.

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