草庐IT

application_name

全部标签

php 数据库库,错误 : SQLSTATE[HY000] Unknown host machine name (severity 2)

我使用的是mac电脑OSX10.9。Freetds和unixODBC已经安装在我的电脑上并作为扩展添加到php,试图连接到远程MSSQL服务器。下面是我的连接测试:错误日志文件显示:[error][client127.0.0.1]PHPFatalerror:Uncaughtexception'PDOException'withmessage'SQLSTATE[HY000]Unknownhostmachinename(severity2)可能是什么问题?如果我使用终端连接到同一个数据库,我的freetds和unixODBC似乎工作正常,如下所示:$isqlHostnameuserpw+-

php - session_id( ) 和 session_name( ) 究竟是什么?解释如何在以下代码中使用它们

?phpfunctiondestroy_session_and_data(){session_start();$_SESSION=array();if(session_id()!=""||isset($_COOKIE[session_name()]))setcookie(session_name(),'',time()-2592000,'/');session_destroy();}?>我明白上面的代码是用来终止session的,但我不明白是否需要if条件和setcookie命令。您能否解释一下session_id()和session_name()到底是什么?如果您能提供清晰的解释,我

php - 如何制定从 id 到 name 的 htaccess 规则

我有一个唯一数据列表:假设我有以下数据:idname1Jhon2Peter3Mark4Scotty5Marry我为id制定了一个.htaccess规则:RewriteRulebrandlisting/(.*)/site/brandlisting?id=$1[L]RewriteRulebrandlisting/(.*)site/brandlisting?id=$1[L]我的网址是:http://localhost/mate/admin/site/brandlisting/3这适用于id。现在我需要一个.htaccess名称规则,所以我为它制定了一个规则:RewriteRulebrandl

php - 匿名函数不起作用 : Function name must be a string

我有:PHPVersion5.4.20'./configure''--disable-fileinfo''--enable-bcmath''--enable-calendar''--enable-ftp''--enable-gd-native-ttf''--enable-libxml''--enable-mbstring''--enable-pdo=shared''--enable-soap''--enable-sockets''--enable-zip''--prefix=/usr/local''--with-apxs2=/usr/local/apache/bin/apxs''--w

php - 从 $_SERVER ['SERVER_NAME' 中删除子域]

我需要制作一个脚本,它将从$_SERVER['SERVER_NAME']中删除子域,以便在setcookie函数的域选项上使用它,以允许在所有可能的子域上访问cookie。例如,假设我有functionstrip_out_subdomain($domain){//dosomethingtoremovesubdomainreturn$only_my_domain;}$domain=strip_out_subdomain($_SERVER['SERVER_NAME']);setcookie('mycookie','123',time()+3600,'/',$domain);这里的主要问题是

php - oci_bind_by_name 和 to_date PHP/OCI/Oracle

我有以下内容:$ARTIFACT_NAME=$_POST['ArtifactName'];$ARTIFACT_TYPE=$_POST['ArtifactType'];$ARTIFACT_LOCATION=$_POST['ArtifactLocation'];$ARTIFACT_DOMAIN=$_POST['ArtifactDomain'];$ARTIFACT_AUTHOR=$_POST['ArtifactAuthor'];$ARTIFACT_LABEL='DB_'.$ARTIFACT_LOCATION.'_'.$ARTIFACT_DOMAIN.'_'.$ARTIFACT_NAME;$A

javascript - 文件获取内容 ('php://input' );使用 application/x-www-form-urlencoded;

我在这里阅读了一些关于该主题的问题,但找不到我正在寻找的答案。我正在用jQuery将一些$.post发送到PHP5.6服务器。$.post('/',{a:100,b:'test'},function(data){},'json');控制台的编码是Content-Typeapplication/x-www-form-urlencoded;charset=UTF-8如果我尝试使用常规$_POST读取POST数据,PHP5.6会提醒我PHPDeprecated:Automaticallypopulating$HTTP_RAW_POST_DATAisdeprecatedandwillberem

php - Facebook OAuthException : "user hasn' t authorized the application to perform this action"

使用FacebookPHPSDK,当我尝试发布状态更新时出现以下错误:Fatalerror:UncaughtOAuthException:(#200)Theuserhasn'tauthorizedtheapplicationtoperformthisaction这些是我采取的步骤:获取代码:https://graph.facebook.com/oauth/authorize?client_id=FB_APP_ID&redirect_uri=REDIRECT_URI获取访问token:https://graph.facebook.com/oauth/access_token?client

php - curl -X POST -H 'Content-Type: application/json' -d 到 PHP

我需要发出curl请求,我有这一行“curl-XPOST-H'Content-Type:application/json'-d”并且需要“翻译”为PHPcurl。问题是我不知道“-X”、“-H”和“-d”是什么意思。curl_setopt($ch,CURLOPT_HTTPHEADER,array('Accept:application/json','Content-Type:application/json','Content-Length:'.strlen($itemJson)));我在标题上尝试了类似的东西($itemJson是一个JSON字符串)但是我得到了错误400。我认为我以

php - 如何在 PHP 5.6 中通过 php.ini 设置 'verify_peer_name=false' SSL 上下文选项

案例:我想打开到localhost的SSL连接,而SSL证书是FQDN的问题。问题:如果(*)行中没有特殊处理,下面的程序将失败并显示以下消息:PHP警告:stream_socket_enable_crypto():对等证书CN='myhost.com'与test.php中预期的CN='localhost'不匹配测试PHP程序:$fp=stream_socket_client("tcp://localhost:993",$errno,$errstr,30);//(*)ifcommented,theprogramfails//stream_context_set_option($fp,'