codeigniter - RIP Tutorial · PDF file from: codeigniter It is an unofficial and free...

Click here to load reader

  • date post

    02-Aug-2020
  • Category

    Documents

  • view

    5
  • download

    0

Embed Size (px)

Transcript of codeigniter - RIP Tutorial · PDF file from: codeigniter It is an unofficial and free...

  • codeigniter

    #codeigniter

  • 1

    1: codeigniter 2

    2

    2

    Examples 2

    2

    Windows 2

    Mac 2

    Linux 2

    GitHub 2

    URL 3

    URLindex.php 3

    4

    4

    AutoLoad Library And Helper 4

    CI 4

    5

    Codeigniter 5

    CodeIgniter 5

    2: CAPTCHA 7

    Examples 7

    7

    create_captcha$ 7

    CAPTCHA 7

    8

    3: CodeIgniter - 9

    9

    Examples 9

    9

    4: CodeIgniter URI 13

  • Examples 13

    URI 13

    URI 13

    5: CodeIgniter/ 14

    14

    Examples 14

    / 14

    6: Codeigniter 17

    Examples 17

    CodeigniterURL 17

    base_url 18

    base_url 18

    18

    http://[::1]/ ?? 18

    base_url() ?? 18

    base_url() ?? 18

    base_url 19

    7: Codeigniter 20

    Examples 20

    20

    20

    8: Codeigniter 21

    21

    Examples 21

    21

    9: CodeIgniter 22

    22

    Examples 22

    22

    22

    CI 22

  • 23

    23

    23

    10: url 25

    Examples 25

    url 25

    11: WAMPCodeIgniterindex.php 26

    Examples 26

    wampcodeigniterurlindex.php 26

    12: 28

    28

    Examples 28

    28

    28

    28

    28

    28

    13: 30

    Examples 30

    30

    30

    30

    pre_system 30

    pre_controller 30

    post_controller_constructor 30

    post_controller 30

    display_override 30

    cache_override 31

    post_system 31

    CodeIgniterPre Controller Hook 31

    31

  • 14: Web 33

    33

    33

    33

    Examples 33

    XSS 33

    SQL 33

    PHP 34

    CSRF 34

    34

    XSS 34

    15: codeigniterModel 36

    Examples 36

    36

    36

    36

    36

    37

    37

    16: CodeigniterAPI 38

    38

    Examples 38

    API 38

    APIAPI 38

    API 39

    apiloged 40

    API 41

    17: linuxcodeignitercronjob 43

    Examples 43

    cronCodeIgniter 43

    CodeigniterCronjob 43

    18: 45

  • 45

    Examples 45

    45

    19: CI 46

    Examples 46

    46

    47

    20: CI 49

    49

    Examples 49

    49

    21: CodeIgniter 50

    Examples 50

    CodeIgniter 50

    codeigniter 51

    22: 52

    52

    Examples 52

    52

    23: flashdata 54

    Examples 54

    54

    Flashdata 54

    24: 55

    Examples 55

    55

    55

    55

    56

    25: 57

    57

  • Examples 57

    57

    57

    57

    58

    HTML 58

    59

    26: INFLECTOR 61

    61

    Examples 61

    61

    61

    61

    61

    Camelized 61

    / 61

    61

    61

    27: 63

    Examples 63

    63

    28: 64

    Examples 64

    Auth 64

    29: Hello World 65

    Examples 65

    Hello World 65

    66

    Hello WorldGood Bye World...... 67

    30: 69

    69

    Examples 69

  • show_error 69

    69

    69

    show_404 69

    69

    69

    log_message 70

    70

    70

    71

  • You can share this PDF with anyone you feel could benefit from it, downloaded the latest version from: codeigniter

    It is an unofficial and free codeigniter ebook created for educational purposes. All the content is extracted from Stack Overflow Documentation, which is written by many hardworking individuals at Stack Overflow. It is neither affiliated with Stack Overflow nor official codeigniter.

    The content is released under Creative Commons BY-SA, and the list of contributors to each chapter are provided in the credits section at the end of this book. Images may be copyright of their respective owners unless otherwise specified. All trademarks and registered trademarks are the property of their respective company owners.

    Use the content presented in this book at your own risk; it is not guaranteed to be correct nor accurate, please send your feedback and corrections to [email protected]

    https://riptutorial.com/zh-TW/home 1

    http://riptutorial.com/ebook/codeigniter https://archive.org/details/documentation-dump.7z mailto:[email protected]

  • 1: codeigniter

    CodeIgniterPHPMVC。

    MVC。

    MVCCodeIgniter;。

    Beta 1.0 2006-02-28

    2.0.0 2011-01-28

    2.2.0 201462

    3.0.0 POP

    3.1.3 201719

    3.1.4 〇

    3.1.5 2017619

    Examples

    Windows

    XAMPPWAMP1. Codeigniter.com2. htdocswww3.

    Mac

    MAMP1. Codeigniter.com2. htdocs3.

    Linux

    Codeigniter.com1. / var / wwwWAMPxampp / htdocsXAMPP2.

    https://riptutorial.com/zh-TW/home 2

    https://www.apachefriends.org/download.html http://www.wampserver.com/en/ https://www.codeigniter.com/download https://www.mamp.info/en/downloads/ https://www.codeigniter.com/download https://www.codeigniter.com/download

  • GitHub git clone https://github.com/bcit-ci/CodeIgniter.git

    URL application/config/config.php1. URL$config['base_url'] = 'http://localhost/path/to/folder';2.

    URLindex.php

    Apache

    root1.

    htaccess2.

    RewriteEngine on RewriteCond $1 !^(index\.php|assets|image|resources|robots\.txt) RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php/$1 [L,QSA]

    3.

    .htaccess。Godaddy?。

    RewriteRule ^(.*)$ index.php?/$1 [L,QSA]

    https://riptutorial.com/zh-TW/home 3

    https://i.stack.imgur.com/k04Jh.png

  • Nginx

    nginx /etc/nginx/sites-available/default 1.

    server { server_name domain.tld; root /path-to-codeigniter-folder; //you codeigniter path index index.html index.php; # set expiration of assets to MAX for caching location ~* \.(ico|css|js|gif|jpe?g|png)(\?[0-9]+)?$ { expires max; log_not_found off; } location / { # Check if a file or directory index file exists, else route it to index.php. try_files $uri $uri/ /index.php; } location ~* \.php$ { fastcgi_pass 127.0.0.1:9000; include fastcgi.conf; } }

    2.

    application/config/database.php1.

    。 • • • • •

    2.

    application/config/routes.php1.

    。 default_controller•

    2.

    AutoLoad Library And Helper

    application/config/autoload.php1.

    $autoload['libraries'] = array('database', 'session');2. $autoload['helper'] = array('url', 'file', 'form', 'html', 'text');3.

    CI

    CodeigniterCI。

    CI。front-endback-endCMS。CI

    https://riptutorial.com/zh-TW/home 4

  • ├── Codeigniter │ ├── applications │ │ ├─ front-end │ │ │ ├── views │ │ │ ├── models │ │ │ ├── controllers │ │ │ ├── config │ │ │ └── ... │ │ ├─ back-end │ │ │ ├── views │ │ │ ├── models │ │ │ ├── controllers │ │ │ ├── config │ │ │ └── ... │ │ │ │ ├── system │ │ ├── core │ │ ├── database │ │ ├── helpers │ │ └── ... │ │ │ ├── index.php └ └── backend.php

    applications front-endback-endapplications。

    index.phpindex.phpbackend.php

    CI。

    Codeigniter

    index.phpbackend.phpapplication_folder confg

    //index.php $application_folder = 'applications/front-end'; //backend.php $application_folder = 'applications/back-end';

    CICI

    example.com/Codeigniter/index.phpfront-end

    example.com/Codeigniter/backend.phpback-end

    CodeIgniter

    CodeIgniter 。CodeIgniter。。

    CodeIgniter Web。.htaccessWeb.htaccess。

    https://riptutorial.com/zh-TW/home 5

    https://www.codeigniter.com/user_guide/installation/index.html https://www.codeigniter.com/user_guide/installation/index.html https://www.codeigniter.com/user_guide/installation/index.html https://www.codeigniter.com/user_guide/installation/index.html

  • ├── CodeIgniter │ ├── application │ ├── system │ ├── wwwroot │ │ ├── index.php

    index.php$system_path $application_folder' /www/MyUser/system' 。。

    Linux / Apache

    $application_folder = './application'; $system_path = './system';

    Windows / IIS

    $application_folder = '../application/'; $system_path = '../system/';

    codeigniter https://riptutorial.com/zh-TW/codeigniter/topic/929/codeigniter

    https://riptutorial.com/zh-TW/home 6

    https://riptutorial.com/zh-TW/codeigniter/topic/929/%E9%96%8B%E5%A7%8B%E4%BD%BF%E7%94%A8codeigniter https://riptutorial.com/zh-TW/codeigniter/topic/929/%E9%96%8B%E5%A7%8B%E4%BD%BF%E7%94%A8codeigniter https://riptutorial.com/zh-TW/codeigniter/topic/929/%E9%96%8B%E5%A7%8B%E4%BD%BF%E7%94%A8codeigniter https://riptutorial.com/zh-TW/codeigniter/topic/929/%E9%96%8B%E5%A7%8B%E4%BD%BF%E7%94%A8codeigniter https://riptutorial.com/zh-TW/codeigniter/topic/929/%E9%96%8B%E5%A7%8B%E4%BD%BF%E7%94%A8codeigniter https://riptutorial.com/zh-TW/codeigniter/topic/929/%E9%96%8B%