小编Jim*_*Jim的帖子

字符编码未在html文档中声明

我有一个文件,我得到一个非常奇怪的错误.错误是:

The character encoding of the HTML document was not declared. 
The document will render with garbled text in some browser configurations if 
the document contains characters from outside the US-ASCII range. 
The character encoding of the page must to be declared in the document or 
in the transfer protocol.
Run Code Online (Sandbox Code Playgroud)

它来自的文件是(indexmws.php):

session_start();
if(!isset($_SESSION['validUser']) || $_SESSION['validUser'] !== true){
header('Location: loginmws.php');
}

include_once('db.php');
include_once('amazonmws.php');
include_once('decidemws.php');
include_once('author.php');
include_once('amazonPricingMWS.php');

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
    <meta …
Run Code Online (Sandbox Code Playgroud)

php encoding

16
推荐指数
2
解决办法
6万
查看次数

四舍五入到最近的50美分

我有以下代码将我的金额四舍五入到最近的美元:

    switch ($amazonResult['SalesRank']) {
    case ($amazonResult['SalesRank'] < 1 || trim($amazonResult['SalesRank'])===''|| !isset($amazonResult['SalesRank']) || $amazonResult['SalesRank']=== null):
        $Price=((float) $lowestAmazonPrice) * 0.05;
        $payPrice = round($Price, 0);  //to round the price up or down to the nearest $
        break; 
    case ($amazonResult['SalesRank'] > 0 && $amazonResult['SalesRank'] <= 15000):
        $Price=((float) $lowestAmazonPrice) * 0.20;
        $payPrice = round($Price, 0);  //to round the price up or down to the nearest $
        break;
Run Code Online (Sandbox Code Playgroud)

我明白,如果我使用圆形($ Price,2); 我将有2位小数,但是有没有办法舍入到最接近的50美分?

php rounding

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

在JS中正确使用长度

我试图使用JS(表使用JQ Tablesorter)和条形码jquery从表中打印出标签(条形码).我的问题是我需要遍历所有的isbn,并且每行显示一个数字.这是我的代码:

    $("#barcode").live('click', function(){
var title="";
var isbn="";
var first = "";
var second = "";
var indexGlobal = 0;

$('#acctRecords tbody tr').each(function()
{
    isbn += $(this).find('#tableISBN').html();
    title += $(this).find('#tableTitle').html();

    });  //end of acctRecords tbody function

//Print the bar codes

    var x=0;
    for (x=0;x<isbn.length;x++)
        {


        first += '$("#'+indexGlobal+'").barcode("'+isbn[x]+'", "codabar",{barHeight:40, fontSize:30, output:"bmp"});';
        second += '<div class="wrapper"><div id="'+indexGlobal+'"></div><div class="fullSKU">&nbsp &nbsp &nbsp '+isbn[x]+
        '</div><br/><div class="title">'+title[x]+'</div></div><br/><br/>';
        indexGlobal++;

        }
var barcode =  window.open('','BarcodeWindow','width=400');
        var html = '<html><head><title>Barcode</title><style type="text/css">'+
        '.page-break{display:block; page-break-before:always; }'+
        'body{width: 8.25in;-moz-column-count:2; -webkit-column-count:2;column-count:2;}'+
        '.wrapper{height: …
Run Code Online (Sandbox Code Playgroud)

javascript tablesorter barcode barcode-printing jquery-barcode

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

在php生成的电子邮件中包含一个链接

我试图在由php生成的电子邮件中包含一个链接.我看过这里可以找到的例子,但我仍然无法让我的工作需要一些帮助.这是我有的:

    //send email when pricing specs are done
$to = $email;
$subject = "Final Check In";
$headers = "From: Warehouse@bookcellaronline.com" . "\r\n" .
"CC: micahpartnerships@gmail.com,lreyes@bookcellaronline.com,jimd@bookcellaronline.com";
$body = "Greetings " .$name."!\nWe have completed checking in your latest shipment of books.\nCheck-In date was: " .$finaldate."\n
We checked in " .$count." books.\nA total of " .$notListed." books are not listed yet and have been set aside to be researched.\nComments: ".$comments. "\n
You will now be able to review your shipment details here : …
Run Code Online (Sandbox Code Playgroud)

php email

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

我可以使用mvc将所有类放在一个文件中吗?

我正在尝试学习MVC,我有一个非常基本的问题.当我创建类和对象时,我可以像使用JavaScript一样将所有这些放在一个文件中吗?或者我是否需要为每个类和构造函数创建一个单独的文件?我在这里看了很多例子,但对我来说似乎没什么.

php model-view-controller

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