我有以下代码,它给我错误:
Message: Invalid parameter number: number of bound variables does not match number of tokens
Run Code Online (Sandbox Code Playgroud)
码:
public function getCount($ids, $outcome)
{
if (!is_array($ids)) {
$ids = array($ids);
}
$qb = $this->getEntityManager()->createQueryBuilder();
$qb->add('select', $qb->expr()->count('r.id'))
->add('from', '\My\Entity\Rating r');
if ($outcome === 'wins') {
$qb->add('where', $qb->expr()->in('r.winner', array('?1')));
}
if ($outcome === 'fails') {
$qb->add('where', $qb->expr()->in('r.loser', array('?1')));
}
$qb->setParameter(1, $ids);
$query = $qb->getQuery();
//die('q = ' . $qb);
return $query->getSingleScalarResult();
}
Run Code Online (Sandbox Code Playgroud)
数据(或$ ids):
Array
(
[0] => 566
[1] => 569
[2] => 571 …Run Code Online (Sandbox Code Playgroud) 当我尝试访问时,info.php我收到一个File not found.错误.
我试过一些教程无济于事.
配置:默认:
server {
listen 80;
listen [::]:80 default ipv6only=on;
server_name localhost;
location / {
root /var/www;
index index.html index.htm index.php;
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
fastcgi_pass 127.0.0.1:7777;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /usr/share/nginx/html$fastcgi_script_name;
fastcgi_buffers 256 128k;
#fastcgi_buffer_size 16k;
#fastcgi_busy_buffers_size 256k;
fastcgi_connect_timeout 300s;
fastcgi_send_timeout 300s;
fastcgi_read_timeout 300s;
include fastcgi_params;
}
}
Run Code Online (Sandbox Code Playgroud)
有什么问题?
我在最后几天尝试了很多东西,但现在我没有想法:(
我想验证在我的Android应用程序中创建的inAppPurchase.
1)我在google API控制台中创建了一个新的服务帐户.
1a)服务帐户列出了非权限,并具有"可以查看"权限
2)我使用的是最新版本的https://github.com/google/google-api-php-client
3)PHP脚本中的代码片段:
$client = new Google_Client();
$client->setApplicationName('myAppName' );
$client->setClientId('123456789123-vxoasdt8qwe6awerc9ysdfmjysdfysf64werweria8fh.apps.googleusercontent.com');
$key = file_get_contents('/shr/data/stor/b516cexx3123asdf3988345d8133e7f86bfas2553-privatekey.p12');
$service_account_name = '123456789123-vxoasdt8qwe6awerc9ysdfmjysdfysf64werweria8fh@developer.gserviceaccount.com';
$client->setScopes(array('https://www.googleapis.com/auth/androidpublisher') );
$cred = new Google_Auth_AssertionCredentials( $service_account_name, array('https://www.googleapis.com/auth/androidpublisher'), $key );
$client->setAssertionCredentials($cred);
try {
$service = new Google_Service_AndroidPublisher( $client );
$googleApiResult = $service->inapppurchases->get($externalAppId, $externalProductId, $purchaseToken);
} catch (Exception $e) {
var_dump( $e->getMessage() );
}
Run Code Online (Sandbox Code Playgroud)
4)Google的回复:
获取https://www.googleapis.com/androidpublisher/v1.1/applications/de.test.myapp/inapp/de.test.inapp.google.balance5eur/purchases/[PURCHASETOKEN] :( 401)当前用户已拥有权限不足以执行请求的操作.
[PURCHASETOKEN]是我从谷歌收到的购买代币
5)将$ cred-> sub ='foo@bar.de'设置为我的邮件地址
刷新OAuth2令牌时出错,消息:'{"error":"unauthorized_client","error_description":"请求中未经授权的客户端或范围".}"
我收到此错误:
Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000]: General error' in ...
Run Code Online (Sandbox Code Playgroud)
..每当我用PDO执行此代码时:
//Select data from the topic.
$s = $dbh->prepare("SELECT * FROM forum_topics WHERE forum_id=:forum_cat_id AND topic_id=:topicid");
$s->bindParam(':forum_cat_id', $forum_cat_id);
$s->bindParam(':topicid', $topicid);
$s->execute();
$f = $s->fetch();
$s = $dbh->prepare("UPDATE forum_cats
SET
forum_last_postid = :last_post_id, forum_last_posttime = :time,
forum_last_userid = :userid, forum_last_username = :username,
forum_posts=forum_posts+1
WHERE forum_id = :forum_cat_id");
$s->bindParam(':last_post_id', $last_post_id);
$s->bindParam(':time', $time);
$s->bindParam(':userid', $userid);
$s->bindParam(':username', $userdata['username']);
$s->bindParam(':forum_cat_id', $forum_cat_id);
try {
$s->execute();
}
catch(PDOException $e) {
die($e->getMessage());
}
if (count($s->fetchAll()) …Run Code Online (Sandbox Code Playgroud) 我正在为Symfony2开发一个相对简单的登录系统.
我有基础知识,工作得很好.
这有点特别之处在于我需要一种方法来提供第三个值(生态系统价值).我的数据库中的用户名本身并不是唯一的,而是生成具有生态系统价值的唯一对.
生态系统值由他们登录的表单提供.
如何在执行登录时考虑此生态系统价值?
我想使用WebClient类将文件上传到主机.我还想传递一些应该显示在服务器部分(PHP)上的$ _POST数组中的值.我想通过一个连接来做到这一点
我用了下面的代码
using (WebClient wc = new WebClient())
{
wc.Encoding = Encoding.UTF8;
NameValueCollection values = new NameValueCollection();
values.Add("client", "VIP");
values.Add("name", "John Doe");
wc.QueryString = values; // this displayes in $_GET
byte[] ans= wc.UploadFile(address, dumpPath);
}
Run Code Online (Sandbox Code Playgroud)
如果我使用了QueryString属性,$ _GET数组中显示的值.但是我想通过post方法发送它
使用symfony 3.1,我们得到了缓存组件(https://github.com/symfony/cache)
我找不到这个组件的任何文档或示例,因为它是新的.
任何人都可以编写简单的示例如何将此组件与symfony 3.1一起使用
我试图在我的项目中使用Doctrine 2,但当我尝试访问命令行从我的数据库导入实体以生成文件时,它会打印来自我的代码 vendor/bin/doctrine
dir=$(d=${0%[/\\]*}; cd "$d"; cd '../doctrine/orm/bin' && pwd)
# See if we are running in Cygwin by checking for cygpath program
if command -v 'cygpath' >/dev/null 2>&1; then
# Cygwin paths start with /cygdrive/ which will break windows PHP,
# so we need to translate the dir path to windows format. However
# we could be using cygwin PHP which does not require this, so we
# test if the path to PHP starts with /cygdrive/ rather than …Run Code Online (Sandbox Code Playgroud) php ×7
doctrine-orm ×2
android ×1
api ×1
c# ×1
caching ×1
doctrine ×1
file-upload ×1
mysql ×1
nginx ×1
pdo ×1
publisher ×1
symfony ×1
symfony-3.1 ×1
web ×1