我在Firebug中看到这个角色.
我不知道为什么会这样,我的代码中没有这样的字符.对于Firefox来说没关系,但在IE中一切都会中断.我甚至无法在Google中搜索此角色.
我用utf-8编码保存了我的文件而没有bom.

我正在从服务器发送这个json响应,请求我的IOS 7应用程序.
{
 "root": {
    "success": "1",
    "message": "Successfully retrieved data.",
    "data": {
        "records": [
            {
                "receipt_key": "xxxxxxxx",
                "receipt_id": "xxxxxxxx",
                "store_name": "xxxxxx",
                "amount": "xxxx",
                "date_purchase": "xxxxxxxx",
                "is_processed": "x",
                "created_on": "xxxxxxxx",
                "modified_on": "xxxxxxxx",
                "modified_on_millis": "xxxxxxxx",
                "user_folder": "xxxxxxxx",
                "category_id": "xxxxxxxx",
                "is_deleted": "x",
                "currency_id": "xxxxxxxx"
            }
        ]
    }
}
}
我使用以下代码解析上面的json到NSDictionary对象.
 NSMutableDictionary *json=[NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingAllowFragments error:&error];
但是我在上面的代码中遇到了这个错误.
Error Domain = NSCocoaErrorDomain Code = 3840"操作无法完成.(Cocoa error 3840.)"(JSON文本不是以数组或对象开头,而是选项允许未设置片段.)UserInfo = 0x8a8a700 {NSDebugDescription = JSON text没有从数组或对象和选项开始,以允许未设置片段.}
我正在使用PHP json_encode()来返回一些由jQuery检索的数据ajax():
简化的JS:
$.ajax({
    dataType: 'json',
    contentType: 'application/json',
    cache: false,
    type: 'POST',
    url: './api/_imgdown.php',
    error: function(jqXHR, textStatus, errorThrow) {
        console.log(jqXHR, textStatus, errorThrow);
    },
    success: function(data, textStatus, jqXHR) {
        console.log(data, textStatus, jqXHR);
    }
});
PHP是:
header('Content-Type: application/json; charset=UTF-8');
//default apiResponse
$apiResponse = [
    "status" => 1,
    "message" => "success",
    "data" => null
];
然后当php运行我的代码时,它会通过添加这些数据结束:
$apiResponse['data'][] = [
    "mid" => (int)$mid,
    "card_type" => $card_type,
    "header_size" => (int)$headers['Content-Length'],
    "saved_size" => (int)filesize($imgSavePath),
    "saved_path" => $imgSavePath
];
//spit out the JSON
echo …当使用php include函数时,include成功执行,但是在输出include的输出之前它也输出一个char,char是十六进制值3F而我不知道它来自哪里,虽然它似乎每个包含都会发生.
起初我认为它是文件编码,但这似乎不是一个问题.我已经创建了一个测试用例来演示它:( 链接不再有效)http://driveefficiently.com/testinclude.php此文件仅包含:
<? include("include.inc"); ?>
和include.inc仅包含:
<? echo ("hello, world"); ?> 
然而,输出是:"你好,世界"在哪里?是一个具有随机值的char.正是这个价值我不知道它的起源,它有时会搞砸我的网站.
关于这可能来自哪里的任何想法?起初我以为它可能与文件编码有关,但我不认为这是一个问题.
我的代码 -
document.getElementById("lblmsg").innerHTML=xmlhttp.responseText;
                if(xmlhttp.responseText == 'Available') 
                    {
                         document.getElementById("newid").value = "";
                    }       
虽然响应文本Available但仍然没有进入条件???
到目前为止,这是我尝试过的:
gulp.task('watch-index-html', function () {
    gulp.watch(files, function (file) {
        return gulp.src('index/index.html')
            .pipe(inject(gulp.src(['index/base3.html']), {
                starttag: '<!-- inject:base3:html -->'
            }))
            .pipe(print(function (file) {
                return "Processing " + file;
             }))
            .pipe(gulp.dest('./'));
    });
});
这是发生了什么:
之前:
<body>
    abcd
    <!-- inject:base3:html -->
    <!-- endinject -->
    efgh
后:
<body>
    abcd
<!-- inject:base3:html -->
<link rel="import" href="/index/base3.html">
<!-- endinject -->
    efgh
我期望看到的是文件的实际内容,而不是该行:
<link rel="import" href="/index/base3.html">
谁能告诉我是否可以通过“插入文件内容”来执行此操作,gulp-inject或者是否还有其他应使用的内容。请注意,过去我尝试使用,gulp-mustache但是在插入字符(65279)时遇到了问题。我认为这与以下问题有关,但是我从来没有胡须为我工作:
如何避免在PHP中回显字符65279?(此问题也与Javascript xmlhttp.responseText(ajax)有关)
我希望有人可以给我一些建议,可以使用gulp-inject或或以gulp-mustache其他任何方式将文件内容插入另一个文件。
ajax ×2
javascript ×2
php ×2
encoding ×1
gulp ×1
gulp-inject ×1
html ×1
ios ×1
ios7 ×1
iphone ×1
jquery ×1
json ×1
node.js ×1
parse-error ×1