小编Ami*_*min的帖子

如何生成yii2验证码和验证码没有任何单词?

我试图在yii2中生成一个验证码,并在字符串数字中生成验证码.有什么办法吗?

security captcha yii2

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

php错误发生警告:mysqli :: close():无法在php中获取mysqli错误

我有问题要建立一个连接到DB的代码,然后关闭连接.

我的DB类如下:

class DataBase {
    private $conn;
    private $info;
    private $db;

    public function __construct ($servername=DB_SERVER, $user=DB_USER, $pass=DB_PASS, $db=DB_DATABASE) {
                $this->db = $db;
                $this->conn = new mysqli($servername,$user,$pass, $this->db);


                if (!$this->conn)
                {
                    if  ($this->conn->connect_error) {
                        $this->info = "ERROR CODE=DB100: Connection failed <br> " . $conn->connect_error;
                        $this->close();
                        echo $this->getInfo();  
                    }
                    else {
                        $this->info = "ERROR CODE=DB101: Connection failed <br> ";
                        $this->close();
                        echo $this->getInfo();
                    }
                }
    }

    public function getInfo () {
        return $this->info;
    }

    // send sql to database
    public function sendQuery ($sql, …
Run Code Online (Sandbox Code Playgroud)

php mysql mysqli

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

如何在vue js中使用Filepond以及如何使用axios上传文件?

我需要使用axios发送发帖请求,以便使用Filepond Uploader上传文件。

我该怎么做?

我正在使用如下所示的自定义流程处理程序,但无法正常工作。

processHandler: (fieldName, file, metadata, load, error, progress, abort) => {
        let formData = new FormData();
        let uploadPercentage = 0;
        formData.append('file', file);
        console.log(formData);

        HTTP.post('v1/upload', formData,
          {
            headers: {
              'Content-Type': 'multipart/form-data'
            },
            onUploadProgress: function (progressEvent) {
              uploadPercentage = parseInt(Math.round((progressEvent.loaded * 100) / progressEvent.total));
              console.log(uploadPercentage);
            }.bind(this)
          })
          .then((response) => {
            console.log(response);
            // Should call the load method when done and pass the returned server file id
            // the load method accepts either a string (id) or an object
            // …
Run Code Online (Sandbox Code Playgroud)

file-upload vue.js axios vuejs2

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

标签 统计

axios ×1

captcha ×1

file-upload ×1

mysql ×1

mysqli ×1

php ×1

security ×1

vue.js ×1

vuejs2 ×1

yii2 ×1