嗨,我收到错误:
[1153] Got a packet bigger than 'max_allowed_packet'bytes
但我没有对我的源代码进行任何更改,托管表示他们没有对服务器设置进行任何更改.
我不知道发生了什么.但我试图找到原因.
那么,如何max_allowed_packet
通过php脚本检查mysql变量?
并且可以在源代码中设置它吗?
我用这段代码来检查图像的类型,
$f_type=$_FILES['fupload']['type'];
if ($f_type== "image/gif" OR $f_type== "image/png" OR $f_type== "image/jpeg" OR $f_type== "image/JPEG" OR $f_type== "image/PNG" OR $f_type== "image/GIF")
{
$error=False;
}
else
{
$error=True;
}
Run Code Online (Sandbox Code Playgroud)
但有些用户抱怨他们在上传任何类型的图片时出错,而其他一些用户则没有收到任何错误!
我想知道这是否解决了这个问题:
if (mime_content_type($_FILES['fupload']['type']) == "image/gif"){...
任何意见?
我正在尝试从服务器端验证表单数据.我的兴趣是用户只需用波斯语字符填写表格.
我正在使用此代码:
$name=trim($_POST['name']);
$name= mysql_real_escape_string($name);
if (preg_match('/^[\u0600-\u06FF]+$/',str_replace("\\\\","",$name))){$err.= "Please use Persian characters!";}
Run Code Online (Sandbox Code Playgroud)
但它不起作用!
这是一个警告:
Warning: preg_match() [function.preg-match]: Compilation failed: PCRE does not support \L, \l, \N, \U, or \u at offset 3 in C:\xampp\htdocs\site\form.php on line 38
Run Code Online (Sandbox Code Playgroud)
我能做什么?
我想使用php脚本在我的Apache服务器上执行.exe文件.程序如下:
用户来,填写一个HTML表单
它gose到一个PHP脚本
php脚本执行该name.exe
文件
php打印name.exe
页面上文件的输出.
我通常从Windows执行name.exe,如下所示:
run--> cmd--> D:\name [command]
name.exe需要与同一目录中的库等其他文件进行通信.
windows中cmd的完整命令是这样的:
D:\name library.dll [input from user]
然后程序执行并在cmd窗口中打印一些结果.
我实际上想在我的客户端上运行我的服务器上的这个程序.我不知道怎么做,但我现在有办法做到这一点.
另一个相关的问题是,我可以在Linux服务器上安装任何shell并在其中执行name.exe吗?
我有一个包含标头响应的字符串变量。像这样
通过发送请求fsockopen()
并通过以下方式获取标头来获取此字符串
$nn= "\r\n";
do {
$header .= fgets ( $fp, 16384 );
} while ( strpos ( $header, $nn . $nn ) === false );
Run Code Online (Sandbox Code Playgroud)
输出:
$header = "HTTP/1.0 200 OK Date: Tue, 13 Sep 2011 07:57:08 GMT Last-Modified: Tue, 13 Sep 2011 07:57:08 GMT
Set-Cookie: EUID=face313a-dddd-11e0-a694-00000aab0f6c;
expires=Mon, 08 Sep 2031 07:57:08 GMT;
path=/;
domain=.mysite.com;
Set-Cookie: MIAMISESSION=face28e8-dddd-11e0-a694-00000aab0f6c:3493353428;
path=/;
domain=.mysite.com;
Set-Cookie: USER_STATE_COOKIE=664d9ed4a110fa1deb0dc4cc2d7e76fa00a75a0b5c9b3fa8;
path=/;
domain=.mysite.com;
Set-Cookie: MIAMIAUTH=f8d13d07cc4e8b0ef9904f5ce40367ce44c989661956ef1cd2804726b0dd5508db661a8f9582df19bc954c57d0f2c293760e4d5ddda88d556dbcfae8dd80a14c8378a2374eb5aeb636e8c4ca7849e48792f5588ad73b3d79ce55afb95660b5052d349082e88b29653d3df674e0fd328f75ad0edb5b63a434c0b7ce44b5c338a0676d6d6648b12e8e7f9570cf24b3ef7b5dfe647f2f36a62114ae5ef23b0a3f6ad15cabba99bf945243553a5329457337884d5671141f6cc438302813801fe2527ad29c1c4e76aedacded581bea2a1b6158b7d8ec3b09e2e6c9a87495f9e6d33188bdc5074d10564d30494e1b1f6af58ab96d11dd4817a0fc17619853792c8785;
path=/;
domain=.mysite.com;
HttpOnly;
Set-Cookie: SY_REMOTEACCESS=;
Content-Type: text/html Expires: Tue, 01 Jan 1980 …
Run Code Online (Sandbox Code Playgroud) 考虑这个数组:
$segments = array(
"key1" =>"111",
"key2" =>"222",
"key3" =>"333",
"key4" =>"444"
);
Run Code Online (Sandbox Code Playgroud)
我想要这些:
$key1
有价值的 "111";
$key2
有价值的 "222";
$key3
有价值的 "333";
$key4
有价值的 "444";
我能做什么 ?
访问该方法的url是这样的:
http://localhost/site/cont/method
我想使用这样的GET方法访问此方法:
http://localhost/new-tera/paper/lookup_doi/segment
但我的segment
部分已经包含/
如下:
http://localhost/lookup_doi/segment/containing/slashes
请注意,整体segment/containing/slashes
是一个值.
我在我的方法中得到这个值,如下所示:
public function method ($variable)
{
echo $variable;
}
Run Code Online (Sandbox Code Playgroud)
//输出:segment
而不是:segment/contains/slashes
php ×7
arrays ×1
codeigniter ×1
cookies ×1
file-upload ×1
mysql ×1
persian ×1
preg-match ×1
unicode ×1
uri ×1