post

php实现手机拍照上传头像功能

喜欢而已 提交于 2020-01-26 08:50:59
现在手机拍照很火,那么如何使用手机拍照并上传头像呢?原因很简单,就是数据传递,首先手机传递照片信息,这个就不是post传递 也不是get函数传递, 这个另外一种数据格式传递,使用的是$GLOBALS ['HTTP_RAW_POST_DATA'],这个系统函数跟post很相似,但是$GLOBALS ['HTTP_RAW_POST_DATA']支持的数据格式更丰富些,详细的区别请自己百度谷歌。 设计流程就是: $GLOBALS ['HTTP_RAW_POST_DATA']传递照片数据流(二进制)-->打开一张空白图--->把数据流写进空白图片里面--判断是否是有效图片---完成。 注意传递照片的二进制流已经包含照片的尺寸大小,格式等等属性,时间上就是把手机图片信息传递到web端页面。 手机端一般使用flash切割照片大小,大家都知道图片和视频是由二进制流组成的,既然图片可以上传,那么视频能不能上传呢?原理是不是和手机拍照上传头像一样呢?自己可以去研究一下 直接上代码 /* * 上传图片类 * @parameter; 用户ID * @date:2011-8-15 * @author:cy * */ function UpImg($subdir){ // 设置存储路径 if(!empty($subdir)){ $dirnow=getcwd(); $folder =$dirnow."

PHP post request and unsupported_grant_type

让人想犯罪 __ 提交于 2020-01-26 04:09:26
问题 this is my code $data = array( 'grant_type' => 'Password', 'username' => 'username', 'password' => 'pwd', 'DeviceId' => '' ); $url = "http://test/sync/oauth/token"; $curl = curl_init($url); curl_setopt($curl, CURLOPT_HEADER, false); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl, CURLOPT_POST, true); curl_setopt($curl, CURLOPT_POSTFIELDS, $data); $response = curl_exec($curl); $status = curl_getinfo($curl, CURLINFO_HTTP_CODE); if ( $status != 201 ) { die("Error: call to

$_POST is empty when axios send POST request CORS

纵然是瞬间 提交于 2020-01-26 03:57:06
问题 When I send POST request with json data in React app to PHP server, $_POST is empty. And also php://input doesn't work. I tried with following code. PHP server side: if($_SERVER['REQUEST_METHOD'] == "OPTIONS") { header('Access-Control-Allow-Origin: *'); header('Access-Control-Allow-Methods: POST, GET, OPTIONS'); header('Access-Control-Allow-Headers: Accept, Content-Type, Content-Length, Accept-Encoding, X-CSRF-Token, Authorization'); header('Access-Control-Max-Age: 1000'); header("Content

PHP - Get path minus root

橙三吉。 提交于 2020-01-26 02:48:59
问题 So I have this link: http://kenthomes.net/Amelia-Cove (We use an alias system.) Then I open a pop-up iframe (http://kenthomes.net/shareplan.php?mod=39) How I can I pass the string "Amelia-Cove" to that page? My best guess was to make the link = to http://kenthomes.net/shareplan.php?mod=39&plan=Amelia-Cove But how to I retrieve only "Amelia-Cove" from the initial page? 回答1: Try this: $_SERVER['REQUEST_URI'] In your above example, this would have a value of: /Amelia-Cove . If you want to get

PHP post request stopped with blank page

∥☆過路亽.° 提交于 2020-01-26 02:28:24
问题 I've got a form with embedded file form (News and NewsFiles collection). On my localhost machine everything works fine: News and NewsFiles entities persists, files are uploaded. But on production server post request is stopped when I try add file. Files are uploaded, entities don't exist in db, post request is stopped with status: 302 Found and it returns blank page instead of redirect to next page. public function createAction(Request $request) { $entity = new News(); $form = $this-

Cannot parse POST parameters of request: '<URL>'

五迷三道 提交于 2020-01-26 00:30:07
Error: java.net.SocketTimeoutException: Read time out weblogic.utils.NestedRuntimeException: Cannot parse POST parameters of request: '<Your Error URL>' Description: Workshop进行程序调试,出现上述两个异常,截图如下: 网上说是因为 页面二次提交 问题,可我的应用不存在二次提交问题。 Accuse: 因为在整理代码的时候我加了些断点, Weblogic Server 启动的时候默认为 Debug 模式 ,这些断点自然就阻止程序的运行,于是出现第一个Time Out 异常,接着出现第二个Cannot parse POST parameters of request 异常。 Action: 通过 Workshop 菜单栏的 Debug 菜单将所有的断点 Disable 掉即可,如下图: 注意: Weblogic Workshop 8.1 的 Server 默认启动为 Debug 模式,默认断点会起作用。 参考: http://xzhsht.blog.163.com/blog/static/5967507220113163518254/ 来源: https://www.cnblogs.com/orientsun

Flask框架总结

谁都会走 提交于 2020-01-25 22:16:52
Flask介绍: Flask是一个基于Python开发并且依赖jinja2模板和Werkzeug WSGI服务的一个微型框架,对于Werkzeug本质是Socket服务端,其用于接收http请求并对请求进行预处理,然后触发Flask框架,开发人员基于Flask框架提供的功能对请求进行相应的处理,并返回给用户,如果要返回给用户复杂的内容时,需要借助jinja2模板来实现对模板的处理,即:将模板和数据进行渲染,将渲染后的字符串返回给用户浏览器。 大白话说就是:短小精悍,轻量 和django对比: django:无socket,依赖第三方模块wsgi,中间件,路由系统(CBV,FBV),视图函数,ORM。cookie,session,Admin,Form,缓存,信号,序列化。。 Flask: 无socket,中间件(扩展),路由系统,视图(CBV)、第三方模块(依赖jinja2),cookie,session弱爆了 大白话说就是:这个框架和django比起来几乎就是什么都没有,只需要简单的引用就可以了,想要插件引用就可以了!但是这也是Flask的缺点,因为遇到任何复杂的业务都需要引用第三方模块,导致Flask比django不稳定一些,开发大型项目也不推荐用Flask,因为当第三方插件用多了之后就更加不容易后期的维护了! 使用: pip3 install flask from flask

Laravel API speed (too slow)

五迷三道 提交于 2020-01-25 20:27:25
问题 i'm trying to develop an API to store alarms coming from several applications into a database. I'm developing the api with Laravel. I've made a C program which makes multiple post requests to the API in order to see how many request can the laravel api process. I have the following route in api.php Route::post('/alarm', 'Api\v1\AlarmController@store'); In my controller i have made the store function which stores the alarm values received in the post request into the database function store

Django入门基础

浪尽此生 提交于 2020-01-25 17:59:52
《Django Web框架笔记》 目录 课程特点: 学习难度大,大部分内容需要理解并记忆 文件较多易混淆 学习阶段注重框架使用,工作阶段注重实现业务逻辑 综合应用强,小练习少 Django框架的介绍 2005年发布,采用Python语言编写的开源web框架 早期的时候Django主做新闻和内容管理的 一个重量级的 Python Web框架,Django 配备了常用的大部分组件 基本配置 路由系统 原生HTML模板系统 视图 view Model模型,数据库连接和ORM数据库管理 中间件 Cookie & Seesion 分页 数据库后台管理系统admin Django的用途 网站后端开发 微信公众号、微信小程序等后台开发 基于HTTP/HTTPS协议的后台服务器开发 在线语音/图像识别服务器 在线第三方身份验证服务器等 Django的版本 最新版本:2.2.x 当前教学版本:1.11.8 Django的官网 官方网址: http://www.djangoproject.com 中文文档(第三方): https://yiyibooks.cn/ http://djangobook.py3k.cn/ Django的离线文档 解压缩数据包 django-docs-1.11-en.zip 用浏览器打开 django-docs-1.11-en/index.html Django的安装

How to fetch checkbox

人盡茶涼 提交于 2020-01-25 11:53:09
问题 This is my HTML code: <input type='checkbox' name='cbox[]' value='Jaywalking'/> Jaywalking<br/> <input type='checkbox' name='cbox[]' value='Littering'/> Littering<br/> <input type='checkbox' name='cbox[]' value='Illegal Vendor'/> Illegal Vendor This is my posting code: if(is_array($_POST['cbox'])) $violation_save=implode(',',$_POST['cbox']); else $violation_save=$_POST['cbox']; mysql_query("UPDATE tblcitizen SET violation='$violation_save' WHERE id='$id'") or die mysql_error()); How can I