contents('php://input') returning string for JSON message

I am trying to read in a JSON message in my PHP app and this is my php code: $json = file_get_contents('php://input'); $obj = json_decode($json, TRUE); echo $obj->{'S3URL'}; When I do this I am getting the following error: Trying to get property of non-object in setImage.php on line 25 (line 25 is the echo $obj->{'S3URL'}; line) This is the request body of the request to the page: Requ

内容('php:// input')返回JSON消息的字符串

我正在尝试阅读我的PHP应用程序中的JSON消息,这是我的PHP代码: $json = file_get_contents('php://input'); $obj = json_decode($json, TRUE); echo $obj->{'S3URL'}; 当我这样做时,我收到以下错误: Trying to get property of non-object in setImage.php on line 25 (line 25 is the echo $obj->{'S3URL'}; line) 这是对页面请求的请求主体: Request Url: http://localhost:8888/setImage.php Request Method:

regex for php to find all self

I've got a system that uses a DomDocumentFragment which is created based on markup from a database or another area of the system (ie other XHTML code). One such tag that may be included is: <div class="clear"></div> Before the string is added to the DomDocumentFragment, the content is correct - the class is closing correctly. However, the DomDocumentFragment transforms this

正则表达式为PHP来找到所有的自我

我有一个使用DomDocumentFragment的系统,它基于数据库或系统其他区域(即其他XHTML代码)的标记创建。 一个可能包含的标签是: <div class="clear"></div> 在将字符串添加到DomDocumentFragment之前,内容是正确的 - 类正确关闭。 但是,DomDocumentFragment将其转换为: <div class="clear"/> 由于标签的错误关闭,这在浏览器中无法正确显示。 所以我的想法是后处理DomDocument返回给我的XML字符

Blank page in IE6

A site I am working on that is built using PHP is sometimes showing a completely blank page. There are no error messages on the client or on the server. The same page may display sometimes but not others. All pages are working fine in IE7, Firefox 3, Safari and Opera. All pages are XHTML with this meta element: <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8"

IE6中的空白页面

我正在使用PHP构建的网站有时会显示一个完全空白的页面。 客户端或服务器上没有错误消息。 同一页面可能会显示,但不会显示其他页面。 所有页面在IE7,Firefox 3,Safari和Opera中均可正常工作。 所有页面都带有这个元素的XHTML: <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" /> 看来我已经通过添加这个PHP代码来解决了这个问题: header('Content-type: text/html; charset=u

@extends('layout') laravel. Blade Template System seems like Not working

I tried to use the laravel's template system: blade but seems like not working when using the code below in the file users.blade.php : @extends('layout') @section('content') Users! @stop and browser, @extends('layout') That should work if you have a template file at /app/views/layout.blade.php that contains <p>Some content here</p> @yield('cont

@extends('布局')laravel。 刀片模板系统似乎不起作用

我试图使用laravel的模板系统: blade但在文件users.blade.php使用下面的代码时似乎users.blade.php : @extends( '布局') @section('content')用户! @停止 和浏览器, @extends( '布局') 如果你在/app/views/layout.blade.php包含一个模板文件,这应该工作 <p>Some content here</p> @yield('content') <p>Some additional content here</p> 然后在你的

How can i set today date as a default date in html

This question already has an answer here: HTML5 Input Type Date — Default Value to Today? 24 answers input type="date"值始终为YYYY-MM-DD格式: <input type="date" value="<?php print(date("Y-m-d")); ?>"/> Like any HTML input field, the browser will leave it empty unless a default value is specified with the value attribute. HTML5 doesn't provide a way of specifying

我如何将今天的日期设置为html中的默认日期

这个问题在这里已经有了答案: HTML5输入类型日期 - 默认值为今天? 24个答案 input type="date"值始终为YYYY-MM-DD格式: <input type="date" value="<?php print(date("Y-m-d")); ?>"/> 与任何HTML输入字段一样,除非使用value属性指定了默认值,否则浏览器将保留为空。 HTML5不提供在值中指定“今天”的方法。 你可以用javascript或php来完成。 以下是PHP的示例: <input type="date" id="

Get the first element of an array

I have an array: array( 4 => 'apple', 7 => 'orange', 13 => 'plum' ) I would like to get the first element of this array. Expected result: string apple One requirement: it cannot be done with passing by reference, so array_shift is not a good solution. How can I do this? Original answer, but costly (O(n)): array_shift(array_values($array)); In O(1): a

获取数组的第一个元素

我有一个数组: array( 4 => 'apple', 7 => 'orange', 13 => 'plum' ) 我想获得这个数组的第一个元素。 预期结果:string apple 一个要求:通过引用传递不能完成,所以array_shift不是一个好的解决方案。 我怎样才能做到这一点? 原始答案,但昂贵(O(n)): array_shift(array_values($array)); 在O(1)中: array_pop(array_reverse($array)); 用其他用例的评论建议编辑

Laravel redirect to route from controller when called by AJAX

Given this chunk of ajax that calls FriendsController@destroy $.ajax({ url: '/dashboard/friends/' + id, type: 'DELETE', data: { src: 'show' }, success: function(response) { } }); How can I return Redirect::route('dashboard.friends.index') inside FriendsController after the delete procedure is completed? I guess this is trying to return the response back to

当被AJAX调用时,Laravel重定向到从控制器路由

鉴于这个调用FriendsController@destroy的ajax块 $.ajax({ url: '/dashboard/friends/' + id, type: 'DELETE', data: { src: 'show' }, success: function(response) { } }); 如何在删除过程完成后return Redirect::route('dashboard.friends.index') FriendsController return Redirect::route('dashboard.friends.index') ? 我想这是试图将回应返回给AJAX,它不知道如何反

Installing memcache in Windows 7 (XAMPP)

I'm using Windows 7, 64 bits, and PHP 5.3.5. memcache is showing as this in phpinfo: Active persistent connections: 0 Version: 2.2.5 Revision: $Revision: 1.114 $ And I'm also getting a connection error Notice: Memcache::get() [memcache.get]: Server localhost (tcp 11211) failed This is what I did: 1) I installed and ran the 64 bit memcached service: http://s3.amazonaws.com/downloa

在Windows 7中安装Memcache(XAMPP)

我使用Windows 7,64位和PHP 5.3.5。 memcache在phpinfo中显示为: Active persistent connections: 0 Version: 2.2.5 Revision: $Revision: 1.114 $ 而且我也遇到连接错误Notice: Memcache::get() [memcache.get]: Server localhost (tcp 11211) failed 这就是我所做的: 1)我安装并运行了64位memcached服务:http://s3.amazonaws.com/downloads.northscale.com/memcached-win64-1.4.4-14.zip。 2)我将php_memcache

HTML PHP Display username after success login

I have a <div> inside my onlinestore.html file which is my menu that contain of Login/Register. What I want is after the success login, the <div> for login/register change to the username. What i'hv done wont display the expected output that i want.So is there something wrong about my code? Here is what I've done: onlinestore.html <li class='active' style='float:righ

HTML PHP成功登录后显示用户名

我在我的onlinestore.html文件中有一个<div> ,它是我的菜单,包含登录/注册。 我想要的是成功登录后,用于登录/注册的<div>更改为用户名。 我所做的不会显示我想要的预期输出。因此,我的代码有什么问题吗? 这是我所做的: onlinestore.html <li class='active' style='float:right;'> <?php session_start(); if($_SESSION['logged']==true){ echo $_SESSION["username"];

with complicated left joins

I'm new to laraval 4. I have this query: SELECT a.id, active, name, email, img_location, IFNULL(b.Total, 0) AS LeadTotal, IFNULL(c.Total, 0) AS InventoryTotal FROM users AS a LEFT JOIN ( SELECT user_id, count(*) as Total FROM lead_user GROUP BY user_id ) AS b ON a.id = b.user_id LEFT JOIN ( SELECT user_id, count(*) as Total FROM user_inventory GROUP BY user_id ) AS c ON a

左连接复杂

我是laraval 4的新手。 我有这个查询: SELECT a.id, active, name, email, img_location, IFNULL(b.Total, 0) AS LeadTotal, IFNULL(c.Total, 0) AS InventoryTotal FROM users AS a LEFT JOIN ( SELECT user_id, count(*) as Total FROM lead_user GROUP BY user_id ) AS b ON a.id = b.user_id LEFT JOIN ( SELECT user_id, count(*) as Total FROM user_inventory GROUP BY user_id ) AS c ON a.id = c.