是我每次使用它时得到的,
$certpath = APP."Plugin".DS."PaypalIpn".DS."Controller".DS."Certificates".DS;
在我的代码中,它破坏了我的 CSS。好吧,不一定是废墟,但我的页面好像没有使用任何 css 来对齐或其他东西。
我需要那个 DS,因为我必须调用那个目录中的文件
$encryption['cert_file'] = $certpath.$encryption['cert_file'];
我试过这个:
$encryption['key_file'] = $certpath.DS.$encryption['key_file'];
$encryption['cert_file'] = $certpath.DS.$encryption['cert_file'];
$encryption['paypal_cert_file'] = $certpath.DS.$encryption['paypal_cert_file'];
仍然没有运气。前两行是这样工作的,但第三行不是。
我尝试使用这些关键字进行谷歌搜索:
directory separator in cakephp ruins my css
uses of directory separator in cakephp
calling files using directory separator in cakephp
但这些都没有帮助我。
DS 只是一个目录分隔符,对吧?可能有什么问题?
..........编辑部分
好吧,这是另一个问题,我从上一期中找到了罪魁祸首,但请解释一下它与我的问题有何关系。这是我的 PaypalHelper.php
<?php
$importConfig = array(
'type' => 'File',
'name' => 'PaypalIpn.ppcrypto',
//'file' => CONFIGS .'paypal_ipn_config.php'
'file' => APP."Plugin".DS."paypal_ipn".DS."libs".DS."ppcrypto.php"
);
//... other codes
//..other functions
function button($title, $options = array(), $buttonOptions = array()) {
//..other codes
$certpath = APP."Plugin".DS."PaypalIpn".DS."Controller".DS."Certificates".DS;
//..other codes
}
?>
看到这段代码了吗?
$importConfig = array(
'type' => 'File',
'name' => 'PaypalIpn.ppcrypto',
//'file' => CONFIGS .'paypal_ipn_config.php'
'file' => APP."Plugin".DS."paypal_ipn".DS."libs".DS."ppcrypto.php"
);
还有这个?
$certpath = APP."Plugin".DS."PaypalIpn".DS."Controller".DS."Certificates".DS;
$encryption['paypal_cert_file'] = $certpath.$encryption['paypal_cert_file'];
$importConfig..错了,因为它应该是
$importConfig = array(
'type' => 'File',
'name' => 'PaypalIpn.ppcrypto',
//'file' => CONFIGS .'paypal_ipn_config.php'
'file' => APP."Plugin".DS."PaypalIpn".DS."libs".DS."ppcrypto.php"
);
..但是当我尝试更正它时,$encryption['paypal_cert_file'] 工作正常。它不会破坏/(禁用??)我的 css
我先把这个作为答案,但我相信我脑子里还有问题..
最佳答案
我几乎可以肯定,无论是错误还是错误,要么是 fatal error ,要么是某种其他错误输出扰乱了您的 HTML 输出。
有时即使启用了调试,屏幕上也看不到错误,您必须检查 HTML 源代码,尤其是当错误发生在 <head>
中时。 HTML 部分,在 Javascript 内部或结束之前 >
的一个标签。我建议当您修复错误时,它就解决了您的问题。
我会仔细检查您是否启用了调试。参见 CakePHP Core Configuration来自蛋糕文档。
如果您已解决问题但仍想知道是什么原因造成的,如果可能,请撤消您的更改并检查我上面提到的内容。除此之外,我没有在您的代码中立即看到任何可能导致问题的明显内容。
关于css - cakephp 中的目录分隔符禁用了我的 CSS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10809531/