我正在使用php curl来接收数据(ssl证书)检查,但回来的数据是(根据firebug)它的html格式中的一大块数据..这里是一个示例输出
HTTP/1.1 200 OK
Date: Mon, 13 Apr 2015 14:10:05 GMT
Server: Apache
Set-Cookie: v1st=9C74FC61F2FB5493; path=/; expires=Wed, 19 Feb 2020 14:28:00 GMT; domain=.geotrust.com
Set-Cookie: v1st=9C74FC61F2FB5493; path=/; expires=Wed, 19 Feb 2020 14:28:00 GMT; domain=.geotrust.com
X-Powered-By: PHP/5.2.13
Expires: Wed, 13 May 2015 14:10:05 GMT
Vary: Accept-Encoding
Cache-Control: max-age=604800, public
Content-Type: text/html
* Rebuilt URL to: https://www.geotrust.com/
* Hostname was found in DNS cache
* Trying 69.58.181.102...
* Connected to www.geotrust.com (69.58.181.102) port 443 (#0)
* successfully set certificate verify locations:
* CAfile: C:\xampp\htdocs\labs\test2\cacert.pem CApath: none
* SSL connection using TLSv1.0 / DHE-RSA-AES256-SHA
* --- Certificate chain
* 0 Subject: 1.3.6.1.4.1.311.60.2.1.3=US; 1.3.6.1.4.1.311.60.2.1.2=Delaware; C=US; ST=California; L=Mountain View; businessCategory=Private Organization; serialNumber=3479750; O=GeoTrust, Inc.; OU=Infrastructure Operations; CN=www.geotrust.com
* Issuer: C=US; O=GeoTrust Inc.; CN=GeoTrust Extended Validation SHA256 SSL CA
* Version: 3 (0x2)
* Serial Number:
* Signature Algorithm: sha256WithRSAEncryption
* Start date: 2015-02-04 00:00:00 GMT
* Expire date: 2017-02-03 23:59:59 GMT
似乎每一行都用通配符*
分隔..我怎样才能干净地输出这些数据?目前我只是在使用
success: function (response) {
$('#ajaxResponse').html(response);
如果我只能显示某些数据但不确定如何,那会很棒。
- 这是萤火虫 -
答案 0 :(得分:1)
如果你想根据它们被*
分隔的假设来格式化它,那么像这样的东西可能适合你:
$('#ajaxResponse').html(response.replace(/\*/g, '<br />'));
答案 1 :(得分:1)
使用<pre>
标记表示它已预先格式化。
$("#ajaxResponse").html('<pre>' + response + '</pre>');