鍍金池/ 問答/ PHP問答
玄鳥 回答

關于 sidebar 和 header 最好通過 vuex 管理狀態(tài)

傲寒 回答

你可以其使用 goto() 函數做控制,但它不能從循環(huán)中跳出。

別瞎鬧 回答

已經解決,直接在save 處寫服務器絕對路徑既可
public function get_test()

{
$file = '456.xls';
  $file_path = ROOT_PATH.'uploads/Tmp/'.$file;
$PHPExcel = new \PHPExcel();
$PHPSheet = $PHPExcel->getActiveSheet();
$PHPSheet->setTitle("demo"); //給當前活動sheet設置名稱
$PHPSheet->setCellValue("A1","姓名")->setCellValue("B1","分數");//表格數據
$PHPSheet->setCellValue("A2","張三")->setCellValue("B2","2121");//表格數據
$objWriter = \PHPExcel_IOFactory::createWriter($PHPExcel, 'Excel2007');
$objWriter->save($file_path); //文件直接下載我指定的服務器目錄中
}
我以為 回答
<!DOCTYPE html>
<html lang="en">
<head>

    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

<form action="index.php" method="post">

    輸入年份: <input type="text" name="yer"/>
    輸入月份: <input type="text" name="mth"/>
    <input type="submit" value="提交" name=""/>

</form>

<?php
@$yer=$_POST['yer'] or die();
@$mth=$_POST['mth'] or die();
$yer=2017;
$mth=4;
if($mth ==1 || $mth == 3|| $mth == 5|| $mth == 7|| $mth == 8|| $mth == 10|| $mth == 12){

    echo '這個月有 <input type="text" value="31天">';
}
else if($mth == 4|| $mth == 6|| $mth == 9|| $mth == 11){

    echo '這個月有 <input type="text" value="30天">';

}
else if($mth == 2){

    if(isrunnian($yer)){
        echo "今年是閏年,這個二月是29天";
    }
    else{
        echo "這個月是29天";
    }
}
function isrunnian($yer){

    if($yer%4 ==0 && !$yer%100 ==0 || $yer%400 ==0){
        return true;
    }
    else{
        return false;
    }
}
?>



</body>
</html>
陌顏 回答

http://www.workerman.net/web-sender
可以通過workerman的phpsocket.io推送

http://wenda.workerman.net/?/question/508
可以在Worker中開一個text端口推送

http://workerman.net/gatewaydoc/advanced/push.html
利用workerman的gatewayWorker推送,使用GatewayClient

什么時候觸發(fā)以及怎么觸發(fā)需要自己控制

舊言 回答

可以在:\App\Exceptions\Handler::render 方法捕獲所有異常錯誤。

clipboard.png
我這開發(fā) API 自定義錯誤消息,你在這里可以捕獲之后自定義郵件內容,然后發(fā)送郵件;
!?。?不推薦在這里發(fā)送,而是加入隊列,通過隊列發(fā)送郵件

生性 回答

/\w+\/\w+/

不歸路 回答

好像沒啥問題

$temp = unpack('C*', '這是為什么');

print_r($temp);

$temp1 = pack('C*', ...$temp);

print_r($temp1);
壞脾滊 回答

你的token在哪里??

  • 如果是放在cookie中,就不用管了,ajax自己會帶上的。
  • 如果不是,header上手動放入token,一下舉例
$.ajax({
????type:"POST",
????url:url,
????data:formData,
????//在請求前設置請求頭 在請求頭里面設置設置請求頭的信息
????beforeSend: function(request) {
????????????request.setRequestHeader("Authorization", token1);
????},
????success:function(res){
????    console.log(res);
????}
});
替身 回答

要做這個功能的話,考慮swoole

兮顏 回答

1.是否有跨域?

2.cookie有同域 同源 策略.

涼薄 回答

對用戶身份進行判斷,如果是普通管理員,去掉where條件不就OK了嗎?

有你在 回答

如果是跳轉指定php文件,參考nginx redirect 配置。如果是想在請求的php文件執(zhí)行前或執(zhí)行后執(zhí)行特定的函數,則在入口或結束前匹配url

空痕 回答

& 符號需要加amp;好像

網妓 回答

單頁面可以出來,你把路由的設置貼出來,看一下

遲月 回答

WeixinJSBridge 去看微信公眾平臺的文檔
你看看這個是不是你要的 http://qydev.weixin.qq.com/wi...

統一下單有很多demo.
你要的是不是 nodejs的實現?
https://github.com/tvrcgo/wei...

孤島 回答

可能時安裝node的時候中途有什么操作中斷了,我出現過類似的問題,我把node卸了重裝就好了,要不你可以試試。

裸橙 回答

大致流程如下:

視圖層

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<form action="/test" method="post">
    {:token()}
    username:
    <input type="text" name="username">
    email:
    <input type="email" name="email">
    <input type="submit" value="submit">
</form>
</body>
</html>

驗證器User

<?php

namespace app\index\validate;

use think\Validate;

class User extends Validate
{
    protected $rule = [
        'username'  => 'require|max:25|token',
        'email'     => 'email',
    ];
}

Controller層

<?php

namespace app\index\controller;

use think\Controller;
use think\Request;

class Index extends Controller
{
    public function index()
    {
        return view('index');
    }

    public function test(Request $request)
    {
        $result = $this->validate(
            [
                '__token__' => $request->param('__token__'),
                'username'  => $request->param('username'),
                'email'     => $request->param('email'),
            ],
            'app\index\validate\User'
        );
        if ($result !== true) {
            dump($result);
        } else {
            dump($request->param());
        }
    }
}