小编Man*_*mar的帖子

无法从select2搜索结果中选择结果

我在我的搜索框上使用select2.我从我的网址获得结果,但我无法从中选择一个选项.我想使用'product.productName'作为选择后显示的文本.有什么我错过了或我做的任何错误.我已经包含了select2.css和select2.min.js,jquery.js

  function dataFormatResult(product) {
        var markup = "<table class='product-result'><tr>";

        markup += "<td class='product-info'><div class='product-title'>" +     product.productName + "</div>";
        if (product.manufacturer !== undefined) {
            markup += "<div class='product-synopsis'>" + product.manufacturer + "</div>";
        }
        else if (product.productOptions !== undefined) {
            markup += "<div class='product-synopsis'>" + product.productOptions + "</div>";
        }
        markup += "</td></tr></table>";
        return markup;
    }

    function dataFormatSelection(product) {
        return product.productName;
    }
    $(document).ready(function() {
        $("#e7").select2({
            placeholder: "Search for a product",
            minimumInputLength: 2,
            ajax: {
                url: myURL,
                dataType: 'json',
                data: function(term,page) {
                    return { …
Run Code Online (Sandbox Code Playgroud)

html php json jquery-select2

11
推荐指数
1
解决办法
8973
查看次数

Symfony2 的 doctirne:mapping:import 中未知数据库类型几何请求错误

我在 Symfony2 中运行doctrine:mapping:import 命令时收到以下错误。我正在使用 SQL Server 2012,即使错误显示“2008Platform 可能不支持它”。

  [Doctrine\DBAL\DBALException]                                                
  Unknown database type geometry requested, Doctrine\DBAL\Platforms\SQLServer  
  2008Platform may not support it. 
Run Code Online (Sandbox Code Playgroud)

我的数据库配置如下所示:

doctrine:
dbal:
    driver:   pdo_sqlsrv
    host:     localhost
    port:     1433
    dbname:   test
    user:     user
    password: password
    charset:  UTF8
Run Code Online (Sandbox Code Playgroud)

我还尝试将映射类型设置为字符串。但它给出了同样的错误。

当我使用 MyMainBundle string --force 尝试该命令时。我收到此错误:

 [Doctrine\ORM\Tools\Export\ExportException]          
  The specified export driver 'string' does not exist
Run Code Online (Sandbox Code Playgroud)

我在这里使用了php 的驱动程序。

doctrine symfony doctrine-orm sql-server-2012

5
推荐指数
1
解决办法
4303
查看次数

获取div标签内的元素值

我在页面上有多个具有不同ID的div标签,具有以下属性:

<div class="alert alert-info" id="1">
                    <p><b><span class="adName">Name</span></b><br>
                    <span class="ad1">address1</span><br>
                    <span class="ad2">address2</span><br>
                    <span class="ad3">address3</span><br>
                    <span class="adCity">city</span><br>
                    <span class="adState">state</span><br>
                    <span class="adPin">pincode</span><br>
                    Ph no :<span class="adPhone">phone</span><br>
                </p>
</div
Run Code Online (Sandbox Code Playgroud)

我想在单击特定div时获取span标记内的值.如何识别单击的div然后获取其内容?

html javascript jquery

4
推荐指数
1
解决办法
1万
查看次数

使用holder.js显示图像缩略图

我正在尝试显示图像usign holder.js但是显示示例图像而不是图像.

<img src='http://upload.wikimedia.org/wikipedia/sr/0/0c/Firefox-logo.png' data-   src="holder.js/140x140" alt='Thumbnail' class="img-thumbnail img-responsive"/>
Run Code Online (Sandbox Code Playgroud)

这是使用holder.js的正确方法吗?有人可以使用holder.js发布一个显示图像的示例吗?

html javascript twitter-bootstrap holder.js twitter-bootstrap-3

3
推荐指数
1
解决办法
2万
查看次数

将文件数组从android上传到$ _FILES

我想从我的android代码上传几个文件,以便在$ _FILES数组中可用.

服务器正在将文件作为数组进行查找.服务器中的php代码看起来像

for ($i=0;$i<$NumFiles;$i++){
   ...
   $filename = $_FILES["fileset"]["name"][$i];
   $filetype = $_FILES["fileset"]["type"][$i];
   $file = curl_image_create($filePath,$filetype,$filename);
   ...
}
Run Code Online (Sandbox Code Playgroud)

我有文件[](fileSet)加载的文件为我的Android代码

        HttpParams httpParams = new BasicHttpParams();
        HttpConnectionParams.setConnectionTimeout(httpParams, TIMEOUT_MILLISEC);
        HttpConnectionParams.setSoTimeout(httpParams, TIMEOUT_MILLISEC);
        HttpClient client = new DefaultHttpClient(httpParams);
        HttpPost request = new HttpPost(this.apiURL);
        MultipartEntityBuilder mpEntity = MultipartEntityBuilder.create();
        StringBody numFilesBody = new StringBody("" + fileSet.length, ContentType.TEXT_PLAIN);
        mpEntity.addPart("NumFiles", numFilesBody);
        for (int i = 0; i < fileSet.length; i++) {
            //What should I be doing here to get the $_FILES set up correctly
        }
        request.setEntity(mpEntity.build());
        HttpResponse response = client.execute(request); …
Run Code Online (Sandbox Code Playgroud)

android androidhttpclient

3
推荐指数
1
解决办法
756
查看次数

在使用CURL获取JSON数据后,json_decode返回一个null对象

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, array('Content-type: application/json'));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$output = curl_exec($ch);
var_dump($output);
$json_array = json_decode($output, true);

var_dump(curl_error($ch));

curl_close($ch);

var_dump($json_array);
Run Code Online (Sandbox Code Playgroud)

VARDUMP为$输出

string(267)"HTTP/1.1 200 OK日期:星期五,2013年3月1日14:16:57 GMT服务器:Apache/2.4.3(Win32)OpenSSL/1.0.1c PHP/5.4.7 X-Powered-By:PHP /5.4.7 cache-control:no-cache x-debug-token:5130b85a178bd Transfer-Encoding:chunked Content-Type:application/json {"name":"manoj"}"

用于curl_error的VARDUMP($ ch)

string(0)""

$ json_array的VARDUMP

空值

php json curl

2
推荐指数
1
解决办法
4983
查看次数

检查 URL 是否返回 PDF

我需要检查 URL 是否使用 PHP 返回 PDF 文档。现在我正在使用 file_get_mimetype 函数。普通 URL ( https://www.google.com/ ) 返回类型为 application/octet-stream 而普通 pdf 链接 ( http://www.brainlens.org/content/newsletters/Spring%202013.pdf ) 返回应用程序/pdf。但现在我也遇到了像http://www.dadsgarage.com/~/media/Files/example.ashxhttp://www.wpdn.org/webfm_send/241这样的URL ,它也是 pdf 但返回 application/octet-溪流。还有其他 URL 也会打开一个另存为对话框,也必须检测到。

php url file-get-contents

0
推荐指数
1
解决办法
2761
查看次数