C++ 调用Matlab画图「建议收藏」

C++ 调用Matlab画图「建议收藏」劳动节闲来无事,写了一天程序,justforfun.看,这是C++调用Matlab画图的一段程序。暂时不想多解释了,有兴趣的话,看看下面的代码吧。#include#include#include#include#include#includeusingnamespace

大家好,又见面了,我是你们的朋友全栈君。如果您正在找激活码,请点击查看最新教程,关注关注公众号 “全栈程序员社区” 获取激活教程,可能之前旧版本教程已经失效.最新Idea2022.1教程亲测有效,一键激活。

Jetbrains全系列IDE使用 1年只要46元 售后保障 童叟无欺

劳动节闲来无事,写了一天程序,just for fun.

看,这是C++调用Matlab画图的一段程序。暂时不想多解释了,有兴趣的话,看看下面的代码吧。

以下几段代码由上到下,越来越旧。最上面的是最新更新的版本。

#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
using namespace std;

#include <Eigen/Eigen>
#include <engine.h>
#include <boost/algorithm/string.hpp>

class MatArray
{
public:
    MatArray() : _data(NULL){}
    MatArray(size_t irows, size_t icols){
        resize(irows, icols);
    }
    MatArray(const MatArray &obj){
        if (obj._data){
            _data = mxCreateDoubleMatrix(obj.rows(), obj.cols(), mxREAL);
            memcpy(this->ptr(), obj.ptr(), sizeof(double)*rows()*cols());
        }
        else{
            _data = NULL;
        }
    }
    ~MatArray(){ mxDestroyArray(_data); _data = NULL; }

    inline size_t rows() const { return _data ? mxGetM(_data) : 0; }
    inline size_t cols() const { return _data ? mxGetN(_data) : 0; }
    inline double* ptr() const { return _data ? mxGetPr(_data) : NULL; }

    bool resize(size_t irows, size_t icols){
        if (!_data){
            _data = mxCreateDoubleMatrix(irows, icols, mxREAL);
            return (_data != NULL);
        }
        if (rows() == irows || cols() == icols){
            return true;
        }
        mxDestroyArray(_data);
        _data = mxCreateDoubleMatrix(irows, icols, mxREAL);
        return (_data != NULL);
    }

    int put(Engine *ep, const char* var_name){
        return engPutVariable(ep, var_name, _data);
    }

    template<class EigenMat = Eigen::MatrixXf>
    void copy_from_eigen(const EigenMat &emat){
        if (emat.rows()*emat.cols() == 0){
            mxDestroyArray(_data); _data = NULL;
        }
        resize(emat.rows(), emat.cols());
        for (int c = 0; c < emat.cols(); c++){
            for (int r = 0; r < emat.rows(); r++){
                (*this)[r + c*(int)(emat.rows())] = emat(r, c);
            }
        }
    }
    inline double& operator[](int i){
        return ptr()[i];
    }
private:
    mxArray *_data;
};

string rndcolor(){
    string color = "[";
    color += to_string((rand() % 256) / 255.) + ",";
    color += to_string((rand() % 256) / 255.) + ",";
    color += to_string((rand() % 256) / 255.) + "]";
    return color;
}

class Matlab
{
private:
    Matlab(const Matlab &obj){}
public:
    Matlab(){
        _engine = engOpen(NULL);
        if (!_engine){
            cerr << "failed to open MATLAB engine!" << endl;
        }
        else{
            cout << "MATLAB has been started successfully!" << endl;
        }
    }
    ~Matlab(){
        // if you are testing algorithm, you are encouraged to keep the line below bing committed.
        //engClose(_engine); _engine = NULL;
    }

    // line_spec : "LineStyle" + "Marker" + "Color", e.g. "-or"
    // for line
    // "LineStyle" = {"none", "-", ":", "-."}
    // "LineWidth" = 0.5
    // "Color" = {[0 0.4470 0.7410] (default) | RGB triplet | {y,m,c,r,g,b,w,k} | 'none'}
    // for Marker
    // "Marker" = {"none", "o", "+", "*", ".", "x", "s", "d", "^", "v", ">", "<", 'p', 'h'}
    // "MarkerEdgeColor" = 'auto' (default) | 'none' | RGB triplet | {y,m,c,r,g,b,w,k}
    // "MarkerFaceColor" = 'auto' (default) | 'none' | RGB triplet | {y,m,c,r,g,b,w,k}
    // "MarkerSize" = 6
    template<class TMatX = Eigen::MatrixXf, class TMatY = Eigen::MatrixXf>
    int plot(const TMatX &X, const TMatY &Y,
        string nm0  = "",
        string nm1  = "", string nm2  = "",
        string nm3  = "", string nm4  = "",
        string nm5  = "", string nm6  = "",
        string nm7  = "", string nm8  = "",
        string nm9  = "", string nm10 = "",
        string nm11 = "", string nm12 = "",
        string nm13 = "", string nm14 = ""
        ){
        MatArray MX, MY;
        MX.copy_from_eigen(X); MX.put(_engine, "MX");
        MY.copy_from_eigen(Y); MY.put(_engine, "MY");
        string plot_code = "MX, MY";
        string code;

#define EVL_CODE(_ARG0,_ARG1) code = var_plot_code(nm##_ARG0, nm##_ARG1); if(code != ""){ plot_code += ", " + code;}
        code = var_plot_code(nm0, "");
        if (code != ""){
            plot_code += ", " + code;
            EVL_CODE(1, 2);
            EVL_CODE(3, 4);
            EVL_CODE(5, 6);
            EVL_CODE(7, 8);
            EVL_CODE(9, 10);
            EVL_CODE(11, 12);
            EVL_CODE(13, 14);
        }
        else{
            EVL_CODE(0, 1);
            EVL_CODE(2, 3);
            EVL_CODE(4, 5);
            EVL_CODE(6, 7);
            EVL_CODE(8, 9);
            EVL_CODE(10, 11);
            EVL_CODE(12, 13);
        }
#undef EVL_CODE
        plot_code = "plot(" + plot_code + ");";
        cout << plot_code << endl;
        exec(plot_code);
        return 0;
    }

    // line_spec : "LineStyle" + "Marker" + "Color", e.g. "-or"
    // for line
    // "LineStyle" = {"none", "-", ":", "-."}
    // "LineWidth" = 0.5
    // "Color" = {[0 0.4470 0.7410] (default) | RGB triplet | {y,m,c,r,g,b,w,k} | 'none'}
    // for Marker
    // "Marker" = {"none", "o", "+", "*", ".", "x", "s", "d", "^", "v", ">", "<", 'p', 'h'}
    // "MarkerEdgeColor" = 'auto' (default) | 'none' | RGB triplet | {y,m,c,r,g,b,w,k}
    // "MarkerFaceColor" = 'auto' (default) | 'none' | RGB triplet | {y,m,c,r,g,b,w,k}
    // "MarkerSize" = 6
    template<class TMatX = Eigen::MatrixXf, class TMatY = Eigen::MatrixXf, class TMask = Eigen::MatrixXi>
    int plot_mask(const TMatX &X, const TMatY &Y, const TMask &mask,
        string nm0  = "",
        string nm1  = "", string nm2  = "",
        string nm3  = "", string nm4  = "",
        string nm5  = "", string nm6  = "",
        string nm7  = "", string nm8  = "",
        string nm9  = "", string nm10 = "",
        string nm11 = "", string nm12 = "",
        string nm13 = "", string nm14 = ""
        ){
        MatArray MX, MY, MS;

        MX.copy_from_eigen(X); MX.put(_engine, "MX");
        MY.copy_from_eigen(Y); MY.put(_engine, "MY");
        MS.copy_from_eigen(mask); MS.put(_engine, "MS");
        string plot_code = "MX(MS>0), MY(MS>0)";
        string code;

#define EVL_CODE(_ARG0,_ARG1) code = var_plot_code(nm##_ARG0, nm##_ARG1); if(code != ""){ plot_code += ", " + code;}
        code = var_plot_code(nm0, "");
        if (code != ""){
            plot_code += ", " + code;
            EVL_CODE(1, 2);
            EVL_CODE(3, 4);
            EVL_CODE(5, 6);
            EVL_CODE(7, 8);
            EVL_CODE(9, 10);
            EVL_CODE(11, 12);
            EVL_CODE(13, 14);
        }
        else{
            EVL_CODE(0, 1);
            EVL_CODE(2, 3);
            EVL_CODE(4, 5);
            EVL_CODE(6, 7);
            EVL_CODE(8, 9);
            EVL_CODE(10, 11);
            EVL_CODE(12, 13);
        }
#undef EVL_CODE
        plot_code = "plot(" + plot_code + ");";
        cout << plot_code << endl;
        exec(plot_code);
        return 0;
    }

    string var_plot_code(string nm, string var){
        boost::trim(nm); boost::trim(var);
        if (nm == ""){
            return "";
        }
        string code = "'" + nm + "'";

        if (var == ""){
            return (nm[0] < 'A' || nm[0] > 'Z') ? code : "";
        }
        if (nm == "LineStyle" || nm == "Marker"){ // string
            // 'LineStyle', '-'
            return code + ", '" + var + "'";
        }
        if (nm == "LineWidth" || nm == "MarkerSize"){ // positive number
            // 'LineWidth', 0.5
            return code + ", " + var;
        }
        if (nm == "Color" || nm == "MarkerEdgeColor" || nm == "MarkerFaceColor"){
            if (var[0] == '['){
                return code + ", " + var;
            }
            else{
                return code + ", '" + var + "'";
            }
        }
        return "";
    }

    int exec(string cmd){
        return engEvalString(_engine, cmd.c_str());
    }

private:
    Engine *_engine;
};

Matlab mbeng;
int main(int argc, char** argv){

    // random circles
    Eigen::ArrayXXf data;
    data = data.Random(1000, 2);
    //mbeng.exec("figure(1); clf;");
    mbeng.plot(data.col(0), data.col(1), "o", "MarkerFaceColor", "[0,0,0]", "MarkerEdgeColor", "[0,0,0]");
    mbeng.exec("axis tight;");


    // different colors
    int K = 4;
    Eigen::ArrayXXi clid;
    clid = Eigen::abs(clid.Random(1000, 1));
    for (int i = 0; i < clid.rows(); i++){
        clid(i, 0) = clid(i, 0) % K;
    }   
    mbeng.exec("figure(2); clf;");
    for (int k = 0; k < K; k++){
        string colors = rndcolor();
        mbeng.plot_mask(data.col(0), data.col(1), (clid == k), "o", "MarkerFaceColor", colors, "MarkerEdgeColor", colors, "MarkerSize", "5");
        mbeng.exec("hold on;");
    }
    mbeng.exec("hold off;");
    mbeng.exec("axis tight;");

    // plot line
    Eigen::ArrayXf X;
    Eigen::ArrayXf Y;
    X = X.LinSpaced(30,-3.1415926f, 3.1415926f);
    Y = X.sin()*X.cos();
    mbeng.exec("figure(3);");
    mbeng.plot(X, Y, "LineStyle", "-.", "Marker", "o", "MarkerSize", "5", "MarkerFaceColor", "[0,1,0]");
    mbeng.exec("axis tight;");

    return EXIT_SUCCESS;
}

这里写图片描述



#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
using namespace std;

#include <Eigen/Eigen>
#include <engine.h>

class MatArray
{
public:
    MatArray() : _data(NULL){}
    MatArray(size_t irows, size_t icols){
        resize(irows, icols);
    }
    MatArray(const MatArray &obj){
        if (obj._data){
            _data = mxCreateDoubleMatrix(obj.rows(), obj.cols(), mxREAL);
            memcpy(this->ptr(), obj.ptr(), sizeof(double)*rows()*cols());
        }
        else{
            _data = NULL;
        }
    }
    ~MatArray(){ mxDestroyArray(_data); _data = NULL; }

    inline size_t rows() const { return _data ? mxGetM(_data) : 0; }
    inline size_t cols() const { return _data ? mxGetN(_data) : 0; }
    inline double* ptr() const { return _data ? mxGetPr(_data) : NULL; }

    bool resize(size_t irows, size_t icols){
        if (!_data){
            _data = mxCreateDoubleMatrix(irows, icols, mxREAL);
            return (_data != NULL);
        }
        if (rows() == irows || cols() == icols){
            return true;
        }
        mxDestroyArray(_data);
        _data = mxCreateDoubleMatrix(irows, icols, mxREAL);
        return (_data != NULL);
    }

    int put(Engine *ep, const char* var_name){
        return engPutVariable(ep, var_name, _data);
    }

    template<class EigenMat = Eigen::MatrixXf>
    void copy_from_eigen(const EigenMat &emat){
        if (emat.rows()*emat.cols() == 0){
            mxDestroyArray(_data); _data = NULL;
        }
        resize(emat.rows(), emat.cols());
        for (int c = 0; c < emat.cols(); c++){
            for (int r = 0; r < emat.rows(); r++){
                (*this)[r + c*(int)(emat.rows())] = emat(r, c);
            }
        }
    }
    inline double& operator[](int i){
        return ptr()[i];
    }
private:
    mxArray *_data;
};

string rndcolor(){
    string color = "[";
    color += to_string((rand() % 256) / 255.) + ",";
    color += to_string((rand() % 256) / 255.) + ",";
    color += to_string((rand() % 256) / 255.) + "]";
    return color;
}

class Matlab
{
private:
    Matlab(const Matlab &obj){}
public:
    Matlab(){
        _engine = engOpen(NULL);
        if (!_engine){
            cerr << "failed to open MATLAB engine!" << endl;
        }
        else{
            cout << "MATLAB has been started successfully!" << endl;
        }
    }
    ~Matlab(){
        // if you are testing algorithm, you are encouraged to keep the line below bing committed.
        //engClose(_engine); _engine = NULL;
    }

    template<class TMatX = Eigen::MatrixXf, class TMatY = Eigen::MatrixXf>
    int plot(const TMatX &X, const TMatY &Y, string line_spec = "", int figure_id = 1, bool hold_on = false){
        MatArray MX, MY, ID;
        MX.copy_from_eigen(X); MX.put(_engine, "MX");
        MY.copy_from_eigen(Y); MY.put(_engine, "MY");
        ID.resize(1, 1); ID[0] = figure_id; ID.put(_engine, "ID");

        string plot_code = " figure(ID); plot(MX, MY";
        if (line_spec != ""){
            plot_code = plot_code + "," + line_spec;
        }
        plot_code += ");";
        plot_code += hold_on ? "hold on;" : "hold off;";

        return engEvalString(_engine, plot_code.c_str());
    }

    template<class TMatX = Eigen::MatrixXf, class TMatY = Eigen::MatrixXf, class TMatC = Eigen::MatrixXf>
    int plot(const TMatX &X, const TMatY &Y, const TMatC &C, int K, int figure_id = 1, int marker_size = 5, string line_and_marker = "o"){
        MatArray MX, MY, MC, ID;
        MX.copy_from_eigen(X); MX.put(_engine, "MX");
        MY.copy_from_eigen(Y); MY.put(_engine, "MY");
        MC.copy_from_eigen(C); MC.put(_engine, "MC");
        ID.resize(1, 1); ID[0] = figure_id; ID.put(_engine, "ID");
        exec("figure(ID); clf;");
        for (int k = 0; k < K; k++){
            string rdc = rndcolor();
            exec(string("idx = MC==") + to_string(k) + ";");
            exec("plot(MX(idx), MY(idx), '" + line_and_marker + "', 'MarkerEdgeColor', " + rdc + ",'MarkerFaceColor'," + rdc + ", 'MarkerSize'," + to_string(marker_size) + "); hold on;");
        }
        exec("hold off;");
        return 0;
    }

    template<class TMatX = Eigen::MatrixXf, class TMatY = Eigen::MatrixXf>
    int plot(const TMatX &X, const TMatY &Y, int figure_id = 1, int marker_size = 5, string line_and_marker = "-"){
        MatArray MX, MY, ID;
        MX.copy_from_eigen(X); MX.put(_engine, "MX");
        MY.copy_from_eigen(Y); MY.put(_engine, "MY");
        ID.resize(1, 1); ID[0] = figure_id; ID.put(_engine, "ID");
        string rdc = rndcolor();
        exec("figure(ID); clf;");
        exec("plot(MX, MY, '" + line_and_marker + "', 'MarkerEdgeColor', " + rdc + ",'MarkerFaceColor'," + rdc + ", 'MarkerSize'," + to_string(marker_size) + "); hold on;");
        exec("hold off;");
        return 0;
    }   

    int exec(string cmd){
        return engEvalString(_engine, cmd.c_str());
    }

private:
    Engine *_engine;
};


#if 1
int main(int argc, char** argv){
    Matlab mbeng;

    // random circles
    Eigen::ArrayXXf data;
    data = data.Random(1000, 2);
    mbeng.plot(data.col(0), data.col(1), 1, 5, "o");
    mbeng.exec("axis tight;");

    // different colors
    int K = 4;
    Eigen::ArrayXXi clid;
    clid = Eigen::abs(clid.Random(1000, 1));
    for (int i = 0; i < clid.rows(); i++){
        clid(i,0) = clid(i,0) % K;
    }   
    mbeng.plot(data.col(0), data.col(1), clid, K, 2);
    mbeng.exec("axis tight;");

    // plot line
    Eigen::ArrayXXf X(1000,1);
    Eigen::ArrayXXf Y(1000,1);
    float fpi = 3.1415926f;
    float sstep = fpi*2 / 1000.f;
    for (int i = 0; i < X.rows(); i++){
        X(i, 0) = -3.1415926f + i*sstep;
        Y(i, 0) = sin(X(i,0))*cos(X(i,0));
    }
    mbeng.plot(X, Y, 3, 5, " - ");
    mbeng.exec("axis tight;");


    return EXIT_SUCCESS;
}
#endif

跑一下:

这里写图片描述


#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <ctime>
using namespace std;


#include <Eigen/Eigen>
#include <engine.h>

class MatArray
{
public:
    MatArray() : _data(NULL){}
    MatArray(size_t irows, size_t icols){
        resize(irows, icols);
    }
    MatArray(const MatArray &obj){
        if (obj._data){
            _data = mxCreateDoubleMatrix(obj.rows(), obj.cols(), mxREAL);
            memcpy(this->ptr(), obj.ptr(), sizeof(double)*rows()*cols());
        }
        else{
            _data = NULL;
        }
    }
    ~MatArray(){ mxDestroyArray(_data); _data = NULL; }

    inline size_t rows() const { return _data? mxGetM(_data):0; }
    inline size_t cols() const { return _data? mxGetN(_data):0; }
    inline double* ptr() const { return _data? mxGetPr(_data):NULL; }

    bool resize(size_t irows, size_t icols){
        if (!_data){
            _data = mxCreateDoubleMatrix(irows, icols, mxREAL);
            return (_data != NULL);
        }
        if (rows() == irows || cols() == icols){
            return true;
        }
        mxDestroyArray(_data); 
        _data = mxCreateDoubleMatrix(irows, icols, mxREAL);
        return (_data != NULL);
    }

    int put(Engine *ep, const char* var_name){
        return engPutVariable(ep, var_name, _data);
    }

    template<class EigenMat=Eigen::MatrixXf>
    void copy_from_eigen(const EigenMat &emat){
        if (emat.rows()*emat.cols() == 0){
            mxDestroyArray(_data); _data = NULL;            
        }
        resize(emat.rows(), emat.cols());
        for (int c = 0; c < emat.cols(); c++){
            for (int r = 0; r < emat.rows(); r++){
                (*this)[r + c*emat.rows()] = emat(r, c);
            }
        }
    }
    inline double& operator[](int i){
        return ptr()[i];
    }

private:
    mxArray *_data;
};

class Matlab
{
private:
    Matlab(const Matlab &obj){}
public:
    Matlab(){
         _engine = engOpen(NULL);
         if (!_engine){
             cerr << "failed to open MATLAB engine!" << endl;
         }
         else{
             cout << "MATLAB has been started successfully!" << endl;
         }       
    }
    ~Matlab(){
        // if you are testing algorithm, you are encouraged to keep the line below bing committed.
        //engClose(_engine); _engine = NULL;
    }

    template<class TMatX = Eigen::MatrixXf, class TMatY = Eigen::MatrixXf>
    int plot(const TMatX &X, const TMatY &Y, string line_spec = "", int figure_id = 1, bool hold_on = false){
        MatArray MX, MY, ID;
        MX.copy_from_eigen(X); MX.put(_engine, "MX");
        MY.copy_from_eigen(Y); MY.put(_engine, "MY");
        ID.resize(1, 1); ID[0] = figure_id; ID.put(_engine, "ID");

        string plot_code = " figure(ID); plot(MX, MY";
        if (line_spec != ""){
            plot_code = plot_code + "," + line_spec;
        }
        plot_code += ");";
        plot_code += hold_on ? "hold on;" : "hold off;";

        return engEvalString(_engine, plot_code.c_str());
    }   

    int exec(string cmd){
        return engEvalString(_engine, cmd.c_str());
    }

private:
    Engine *_engine;
};

string rndcolor(){
    string color = "[";
    color += to_string((rand() % 256) / 255.) + ",";
    color += to_string((rand() % 256) / 255.) + ",";
    color += to_string((rand() % 256) / 255.) + "]";
    return color;
}

int main(int argc, char** argv){
    Eigen::MatrixXf data;

    srand((unsigned int)time(0));
    data = data.Random(1000, 2);

    Matlab mateng;
    //mateng.exec("clear all; close all;");
    mateng.plot(data.col(0), data.col(1), string("'s',") + "'MarkerEdgeColor'," + rndcolor() + ",'MarkerFaceColor'," + rndcolor() + ", 'MarkerSize', 5", 1, true);

    return EXIT_SUCCESS;
}

执行一下!看看结果!

这里写图片描述

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/191565.html原文链接:https://javaforall.net

(0)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • 开源3d可视化软件_开源的可视化大屏

    开源3d可视化软件_开源的可视化大屏第一节、 技术开发环境中的社会环境    这篇文章迟迟没有写出来奉献给一些爱好音频视频开发的网友,是有很多原因的,TI在短时间内,针对高清音视频方案DM365/368,连续发布DVSDK3.0,DVSDK4.00,DVSDK4.01和DVSDK4.02,这点让我们很不适应。虽然我们的DM365/368核心板早已经出来,但是需要做开发板,并调试开…

    2022年8月13日
    4
  • 万能乘法速算法大全_小学数学各年级知识点和重点、难点大全,复习必备提纲!…

    万能乘法速算法大全_小学数学各年级知识点和重点、难点大全,复习必备提纲!…今天小数老师为不同年级的学生整理出小学数学重要知识点帮助小伙伴们及时查缺补漏哦!一年级的知识重点1数与计算(1)20以内数的认识,加法和减法。数数。数的组成、顺序、大小、读法和写法。加法和减法。连加、连减和加减混合式题(2)100以内数的认识。加法和减法。数数。个位、十位。数的顺序、大小、读法和写法。两位数加、减整十数和两位数加、减一位数的口算。两步计算的加减式题。2量与计量钟面的认识(…

    2022年6月7日
    61
  • 怎么把python中的列表转化为字符串(python成长记录)

    怎么把python中的列表转化为字符串(python成长记录)怎么把python中的列表转化为字符串(python成长记录)1,列表中非字符串的元素的转换方法一:使用列表推导式转换list1=[‘happy’,1,6,’sad’]list1=[str(i)foriinlist1]print(list1)结果为[‘happy’,’1′,’6′,’sad’]方法二:使用map高级函数转换list1=[‘happy’,1,6,…

    2022年5月30日
    33
  • python中面向对象VS面向过程

    python中面向对象VS面向过程面向过程编程:首先分析出解决问题所需要的步骤(即“第一步做什么,第二步做什么,第三步做什么”),然后用函数实现各个步骤,再依次调用。面向对象编程:会将程序看作是一组对象的集合,用这种思维设计代码时,

    2022年7月5日
    19
  • 黄聪:在C#中如何使用资源中的图片

    黄聪:在C#中如何使用资源中的图片

    2021年8月5日
    53
  • 如何利用腾讯云服务器搭建个人网站[通俗易懂]

    如何利用腾讯云服务器搭建个人网站[通俗易懂]你是否想要搭建一个网站,却苦苦找不到方法,你是否看到别人搭建的网站,自己羡慕不已,今天,就教大家来搭建一个简单的个人网站。在这里,我采用的是腾讯云服务器搭建的。首先,需要注册腾讯云账号,登录腾讯云,点击控制台进入控制台后,选择域名注册看到的结果如下图所示:开始注册域名:提交订单后,域名就注册成功了。接下来需要购买云主机(云服务器),流程如下用…

    2022年6月29日
    44

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号