草庐IT

app-name

全部标签

php array_filter function not found or invalid function name 不管我输入什么

我之前从未使用过array_filter函数,所以无论我使用什么作为函数名称,它都会给我错误,请尝试一下Warning:array_filter()expectsparameter2tobeavalidcallback,function'odd'notfoundorinvalidfunctionnamein我什至采取了直接从php手册页复制粘贴示例的步骤,它给了我同样的错误。代码:functionodd($var){//returnswhethertheinputintegerisoddreturn($var&1);}functioncalculate($res,$period,$el

PHP 文件上传 : keep both files if same name

在PHP中是否有任何漂亮的解决方案允许我在文件名已经存在的情况下使用自动递增数字扩展文件名?我不想在一些不可读的东西中重命名上传的文件。所以我认为这样会很好:(允许所有图像文件。)Cover.pngCover(1).pngCover(2).png… 最佳答案 首先,让我们分开扩展名和文件名:$file=pathinfo();为了便于文件检查和追加,将文件名保存到新变量中:$filename=$file['filename'];然后,让我们检查文件是否已经存在并保存新的文件名,直到它不存在为止:$i=1;while(file_exis

php - 编译失败 : unknown property name after\P or\p

您好,我想匹配一个字符串:“\parhello\parworld”针对我的正则表达式模式->\\par但是,我得到一个Compilationfailed:unknownpropertynameafter\Por\p我相信我的正则表达式规则被视为unicode字符属性。我如何转义它并按原样运行模式?我像这样将它包含在PDO函数中。functionsqlite_regExp($sql,$db){if($db->sqliteCreateFunction("regexp","preg_match",2)===FALSE)exit("Failedcreatingfunction!");if($r

php - 使用部署在 Google App Engine 上的 PHP 应用程序发送邮件

我正在尝试从部署在GAE上的PHP应用程序发送电子邮件,但无法发送。我的PHP代码:$email,"to"=>"abc@gmail.com","subject"=>"Subject","textBody"=>$query,];try{$message=newMessage($mail_options);$message->send();}catch(InvalidArgumentException$e){echo"notsend";}?>我的日志INFO2014-07-3121:40:31,711mail_stub.py:142]MailService.SendFrom:bca@gma

php - 是否可以像 % :name% 这样的名称绑定(bind)参数

我正在测试一个小的搜索功能:但是我遇到了一个我似乎无法解决的错误。您可以在此处查看PDO查询:$search="test1";//latertobechangesto$_POST['search'];$sql="SELECTid,nameFROMclientsWHEEnamelike%:name%orderbyidLIMIT5";$stm=$db->prepare($sql);$stm->bindParam(":name",$search);$result=$stm->execute();如您所见,我正在尝试从我的查询中绑定(bind)参数%:name%,但我不知道这是否真的可行?我收

php - 在 cmd 中运行 php 会拒绝访问并在您的 PC 上运行 "This app can' t”

我在windows8.1上安装了xampp,想将PHP添加到环境变量中。因此,在我添加的路径下;C:\xampp\php;最后,就像我很久以前做过的那样。现在,当我尝试在cmd中运行任何php函数时,我收到了windows消息"Thisappcan'trunonyourPC.."和cmd中的“访问被拒绝”。如果我从路径变量中删除php,我仍然会遇到同样的错误。我怀疑可能有问题的是,当我尝试通过键入SETPATH=%PATH%添加变量时,我不小心单击了enter,因此可能添加了一个一些奇怪的值,虽然我已经仔细检查并且整条线看起来都很好(没有奇怪的剩菜或其他东西)。

php - URL 不接受字母数字参数 - Yii2-app-basic

很快,我将在URL中传递41。confirm.php打印41。http://localhost/yii2-app-basic/web/site/confirm/41但是,当我在URL中传递“cfeb70c4c627167ee56d6e09b591a3ee”或“41a”时,http://localhost/yii2-app-basic/web/site/confirm/41a显示错误NOTFOUND(#404)Pagenotfound.TheaboveerroroccurredwhiletheWebserverwasprocessingyourrequest.Pleasecontactu

PHP 错误 : Function name must be a string/Undefined Variable send_sms

if(!empty($_GET['new_time'])){$sql2="SELECT*FROM".$table_name."WHEREid=".$_GET['new_time'];$result2=mysqli_query($conn,$sql2);$rows=mysqli_fetch_assoc($result2);$mobile_number=$rows['mobile_number'];//Createinstancewithkey$key='AIzaSyD1tPfs4s2dYYHMkCOqNZoVsTkDyud-9Yg';$googer=newGoogleURLAPI($ke

php - 使用 nginx 设置常量 SERVER_NAME

我有具有以下结构的nginx.conf:http{[...]server{[...]location~\.php${fastcgi_passunix:/run/php/php7.0-fpm.sock;fastcgi_split_path_info^(.+\.php)(/.*)$;fastcgi_paramSCRIPT_FILENAME$document_root$fastcgi_script_name;fastcgi_paramSERVER_NAME$host;fastcgi_read_timeout3000;includefastcgi_params;}}}这个nginx在Docke

php - Php $this->$propery_name 和 $this->propery_name 有什么区别

$protected_property_name='_'.$name;if(property_exists($this,$protected_property_name)){return$this->$protected_property_name;}我正在学习面向对象编程的教程,但是,讲师提出了一种我以前从未见过的新代码结构,但没有明确解释他这样做的原因。如果您在if(statement)中注意到$this->$protected_property_name语句有两个$符号,一个用于$this,另一个用于$protected_property_name通常它应该只是$this->pr