我的openwrt学习笔记(十九):linux便捷开发命令之strace

学习linux命令的是LINUX 的基础,相信很多人N多年前就知道这个命令,学习额时候也用过它,但是久而久之这个命令就淡出了我们的视野!在实际的工作中有时候会遗忘它,终其主要原因是字实际应用中运用的不够多!

今天介绍个特别有用的命令,strace,可以跟踪程序的执行调用过程,它可以给你提供程序执行错误的相关信息!

1.


[email protected]:~$ which strace

/usr/bin/strace

[email protected]:~$ strace -V

strace -- version 4.5.20

[email protected]:~$ strace -v

usage: strace [-dffhiqrtttTvVxx] [-a column] [-e expr] ... [-o file]

[-p pid] ... [-s strsize] [-u username] [-E var=val] ...

[command [arg ...]]

or: strace -c -D [-e expr] ... [-O overhead] [-S sortby] [-E var=val] ...

[command [arg ...]]

-c -- count time, calls, and errors for each syscall and report summary

-f -- follow forks, -ff -- with output into separate files

-F -- attempt to follow vforks, -h -- print help message

-i -- print instruction pointer at time of syscall

-q -- suppress messages about attaching, detaching, etc.

-r -- print relative timestamp, -t -- absolute timestamp, -tt -- with usecs

-T -- print time spent in each syscall, -V -- print version

-v -- verbose mode: print unabbreviated argv, stat, termio[s], etc. args

-x -- print non-ascii strings in hex, -xx -- print all strings in hex

-a column -- alignment COLUMN for printing syscall results (default 40)

-e expr -- a qualifying expression: option=[!]all or option=[!]val1[,val2]...

options: trace, abbrev, verbose, raw, signal, read, or write

-o file -- send trace output to FILE instead of stderr

-O overhead -- set overhead for tracing syscalls to OVERHEAD usecs

-p pid -- trace process with process id PID, may be repeated

-D -- run tracer process as a detached grandchild, not as parent

-s strsize -- limit length of print strings to STRSIZE chars (default 32)

-S sortby -- sort syscall counts by: time, calls, name, nothing (default time)

-u username -- run command as username handling setuid and/or setgid

-E var=val -- put var=val in the environment for command

-E var -- remove var from the environment for command

2.


Test.c代码

#include <stdio.h>

int main(void)

{

printf("hi,strace test 20150814\n");

return 0;

}


[email protected]:~/linux_c$ touch test.c

[email protected]:~/linux_c$ vi test.c

[email protected]:~/linux_c$ gcc -g test.c

li[email protected]:~/linux_c$ ./a.out

hi,strace test 20150814

[email protected]:~/linux_c$ strace a.out

strace: a.out: command not found

[email protected]:~/linux_c$ strace ./a.out

execve("./a.out", ["./a.out"], [/* 37 vars */]) = 0

brk(0)                                  = 0x9a21000

access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)

mmap2(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7782000

access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or directory)

open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3

fstat64(3, {st_mode=S_IFREG|0644, st_size=74329, ...}) = 0

mmap2(NULL, 74329, PROT_READ, MAP_PRIVATE, 3, 0) = 0xb776f000

close(3)                                = 0

access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)

open("/lib/i386-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3

read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0000\226\1\0004\0\0\0"..., 512) = 512

fstat64(3, {st_mode=S_IFREG|0755, st_size=1713640, ...}) = 0

mmap2(NULL, 1723100, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0xb75ca000

mmap2(0xb7769000, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x19f) = 0xb7769000

mmap2(0xb776c000, 10972, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0xb776c000

close(3)                                = 0

mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb75c9000

set_thread_area({entry_number:-1 -> 6, base_addr:0xb75c9900, limit:1048575, seg_32bit:1, contents:0, read_exec_only:0, limit_in_pages:1, seg_not_present:0, useable:1}) = 0

mprotect(0xb7769000, 8192, PROT_READ)   = 0

mprotect(0x8049000, 4096, PROT_READ)    = 0

mprotect(0xb77a5000, 4096, PROT_READ)   = 0

munmap(0xb776f000, 74329)               = 0

fstat64(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 2), ...}) = 0

mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7781000

write(1, "hi,strace test 20150814\n", 24hi,strace test 20150814

) = 24

exit_group(0)                           = ?

[email protected]:~/linux_c$

3.

strace案例

用strace调试程序例子

http://www.cnblogs.com/ggjucheng/archive/2012/01/08/2316692.html

http://www.cnblogs.com/bangerlee/archive/2012/02/20/2356818.html

http://jingyan.baidu.com/article/a3761b2bb92d2d1576f9aa05.html

4.

编译strace  ,最新版strace-4.10

http://sourceforge.net/projects/strace/

编译

授人以鱼不如授人以渔

先看readme 提示编译安装查看 install文件


[email protected]:~/linux_c/strace-4.10$ ./configure --help

`configure‘ configures strace 4.10 to adapt to many kinds of systems.

Usage: ./configure [OPTION]... [VAR=VALUE]...


[email protected]:~/linux_c/strace-4.10$ ./configure -V

strace configure 4.10

generated by GNU Autoconf 2.69

Copyright (C) 2012 Free Software Foundation, Inc.

This configure script is free software; the Free Software Foundation

gives unlimited permission to copy, distribute and modify it.


generated by GNU Autoconf 2.69

别小看这句话,这句话告诉你configure是按照Autoconf库创建出来的,有标准通用参数

如以下:


[email protected]:~/linux_c/strace-4.10$ ./configure CC=/usr/bin/gcc

[email protected]:~/linux_c/strace-4.10$ make

.o strace-utimes.o strace-v4l2.o strace-vsprintf.o strace-wait.o strace-xattr.o

make[2]: Leaving directory `/home/linux/linux_c/strace-4.10‘

make[1]: Leaving directory `/home/linux/linux_c/strace-4.10‘

[email protected]:~/linux_c/strace-4.10$ make install

make  install-recursive

make[1]: Entering directory `/home/linux/linux_c/strace-4.10‘

Making install in tests

make[2]: Entering directory `/home/linux/linux_c/strace-4.10/tests‘

make[3]: Entering directory `/home/linux/linux_c/strace-4.10/tests‘

make[3]: Nothing to be done for `install-exec-am‘.

make[3]: Nothing to be done for `install-data-am‘.

make[3]: Leaving directory `/home/linux/linux_c/strace-4.10/tests‘

make[2]: Leaving directory `/home/linux/linux_c/strace-4.10/tests‘

make[2]: Entering directory `/home/linux/linux_c/strace-4.10‘

make[3]: Entering directory `/home/linux/linux_c/strace-4.10‘

/bin/mkdir -p ‘/usr/local/bin‘

/usr/bin/install -c strace ‘/usr/local/bin‘

/usr/bin/install: cannot create regular file `/usr/local/bin/strace‘: Permission denied

make[3]: *** [install-binPROGRAMS] Error 1

make[3]: Leaving directory `/home/linux/linux_c/strace-4.10‘

make[2]: *** [install-am] Error 2

make[2]: Leaving directory `/home/linux/linux_c/strace-4.10‘

make[1]: *** [install-recursive] Error 1

make[1]: Leaving directory `/home/linux/linux_c/strace-4.10‘

make: *** [install] Error 2

[email protected]:~/linux_c/strace-4.10$ file strace

strace: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.24, BuildID[sha1]=0x06f3c3b4e130a4374122afc287fb62d41ce3f644, not stripped

Openwrt编译mips –el 编译器


[email protected]:~/mt7688/openwrt-3.10.14/bin/ramips$ ls -l

total 49040

-rw-r--r-- 1 linux linux      360 Aug 14 16:41 md5sums

-rw-r--r-- 1 linux linux  3407876 Aug 14 16:41 openwrt-ramips-mt7628-mt7628-squashfs-sysupgrade.bin

-rw-r--r-- 1 linux linux  1966080 Aug 14 16:41 openwrt-ramips-mt7628-root.squashfs

-rw-r--r-- 1 linux linux  1267526 Aug 14 16:41 openwrt-ramips-mt7628-uImage.bin

-rwxr-xr-x 1 linux linux  3750544 Aug 14 16:41 openwrt-ramips-mt7628-vmlinux.bin

-rwxr-xr-x 1 linux linux  3816984 Aug 14 16:41 openwrt-ramips-mt7628-vmlinux.elf

-rw-r--r-- 1 linux linux 36051998 Aug 14 16:42 OpenWrt-Toolchain-ramips-for-mipsel_24kec+dsp-gcc-4.8-linaro_uClibc-0.9.33.2.tar.bz2

drwxr-xr-x 5 linux linux     4096 Aug  7 16:39 packages

[email protected]:~/mt7688/openwrt-3.10.14/bin/ramips$ pwd

/home/linux/mt7688/openwrt-3.10.14/bin/ramips

所以可见编译好后  工具链存放于/home/linux/mt7688/openwrt-3.10.14/bin/ramips

Mips工具链安装

解压工具链~/app下

[email protected]:~/app/OpenWrt-Toolchain-ramips-for-mipsel_24kec+dsp-gcc-4.8-linaro_uClibc-0.9.33.2/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/bin$

[email protected]:~$ cat /etc/environment

PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games"

[email protected]:~$ vi /etc/environment

[email protected]:~$ sudo chmod 777 /etc/environment

[sudo] password for linux:

[email protected]:~$ vi /etc/environment

[email protected]:~$ echo $PATH

/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games

[email protected]:~$ source /etc/environment

[email protected]:~$ echo $PATH

/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:~/app/OpenWrt-Toolchain-ramips-for-mipsel_24kec+dsp-gcc-4.8-linaro_uClibc-0.9.33.2/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/bin

[email protected]:~/linux_c$ mipsel-openwrt-linux-gcc -g test.c

mipsel-openwrt-linux-uclibc-gcc.bin: warning: environment variable ‘STAGING_DIR‘ not defined

mipsel-openwrt-linux-uclibc-gcc.bin: warning: environment variable ‘STAGING_DIR‘ not defined

mipsel-openwrt-linux-uclibc-gcc.bin: warning: environment variable ‘STAGING_DIR‘ not defined

[email protected]:~/linux_c$ ls -l

total 612

-rwxrwxr-x  1 linux linux   6938 Aug 14 16:51 a.out

drwxr-xr-x 11 linux linux  12288 Aug 14 16:32 strace-4.10

-rw-rw-r--  1 linux linux 601856 Aug 14 16:18 strace-4.10.tar.xz

-rw-rw-r--  1 linux linux     89 Aug 14 16:01 test.c

[email protected]:~/linux_c$ file a.out

a.       out: ELF 32-bit LSB executable, MIPS, MIPS32 rel2 version 1, dynamically linked (uses shared libs), with unknown capability 0xf41 = 0x756e6700, with unknown capability 0x70100 = 0x3040000, not
stripped

http://blog.csdn.net/flymachine/article/details/7055923

如何交叉编译strace工具

strace mips编译器编译

li[email protected]:~/linux_c/strace-4.10$
./configure --host=/home/linux/app/OpenWrt-Toolchain-ramips-for-mipsel_24kec+dsp-gcc-4.8-linaro_uClibc-0.9.33.2/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/bin/mipsel-openwrt-linux-gcc

checking for a BSD-compatible install... /usr/bin/install -c

checking whether build environment is sane... yes

checking for /home/linux/app/OpenWrt-Toolchain-ramips-for-mipsel_24kec+dsp-gcc-4.8-linaro_uClibc-0.9.33.2/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/bin/mipsel-openwrt-linux-gcc-strip... no

checking for strip... strip

checking for a thread-safe mkdir -p... /bin/mkdir -p

checking for gawk... gawk

checking whether make sets $(MAKE)... yes

checking whether make supports nested variables... yes

checking whether to enable maintainer-specific portions of Makefiles... no

checking build system type... i686-pc-linux-gnu

checking host system type... Invalid configuration `/home/linux/app/OpenWrt-Toolchain-ramips-for-mipsel_24kec+dsp-gcc-4.8-linaro_uClibc-0.9.33.2/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/bin/mipsel-openwrt-linux-gcc‘: machine `/home/linux/app/OpenWrt-Toolchain-ramips-for-mipsel_24kec+dsp-gcc-4.8-linaro_uClibc-0.9.33.2/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/bin/mipsel-openwrt-linux‘
not recognized

configure: error: /bin/bash ./config.sub /home/linux/app/OpenWrt-Toolchain-ramips-for-mipsel_24kec+dsp-gcc-4.8-linaro_uClibc-0.9.33.2/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/bin/mipsel-openwrt-linux-gcc failed

、//-----------------------

l[email protected]:~/linux_c/strace-4.10$ ./configure CC=/home/linux/app/OpenWrt-Toolchain-ramips-for-mipsel_24kec+dsp-gcc-4.8-linaro_uClibc-0.9.33.2/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/bin/mipsel-openwrt-linux-gcc

checking for a BSD-compatible install... /usr/bin/install -c

checking whether build environment is sane... yes

checking for a thread-safe mkdir -p... /bin/mkdir -p

checking for gawk... gawk

checking whether make sets $(MAKE)... yes

checking whether make supports nested variables... yes

checking whether to enable maintainer-specific portions of Makefiles... no

checking build system type... i686-pc-linux-uclibc

checking host system type... i686-pc-linux-uclibc

checking for gcc... /home/linux/app/OpenWrt-Toolchain-ramips-for-mipsel_24kec+dsp-gcc-4.8-linaro_uClibc-0.9.33.2/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/bin/mipsel-openwrt-linux-gcc

checking whether the C compiler works... yes

checking for C compiler default output file name... a.out

checking for suffix of executables...

checking whether we are cross compiling... configure: error: in `/home/linux/linux_c/strace-4.10‘:

configure: error: cannot run C compiled programs.

If you meant to cross compile, use `--host‘.

See `config.log‘ for more details

恩??为毛不对

[email protected]:~/linux_c/strace-4.10$ ./configure --host=mipsel-openwrt-linux CC=mipsel-openwrt-linux-gcc LD=mipsel-openwrt-linux-ld

checking for libunwind-ptrace.h... no

checking whether to enable stack tracing support using libunwind... no

Generated MIPS syscallent stubs

checking that generated files are newer than configure... done

configure: creating ./config.status

config.status: creating Makefile

config.status: creating tests/Makefile

config.status: creating tests-m32/Makefile

config.status: creating tests-mx32/Makefile

config.status: creating config.h

config.status: executing depfiles commands

[email protected]:~/linux_c/strace-4.10$ make

e-sysmips.o strace-term.o strace-time.o strace-truncate.o strace-uid.o strace-uid16.o strace-umask.o strace-umount.o strace-uname.o strace-util.o strace-utime.o strace-utimes.o strace-v4l2.o strace-vsprintf.o strace-wait.o strace-xattr.o

mipsel-openwrt-linux-uclibc-gcc.bin: warning: environment variable ‘STAGING_DIR‘ not defined

mipsel-openwrt-linux-uclibc-gcc.bin: warning: environment variable ‘STAGING_DIR‘ not defined

make[2]: Leaving directory `/home/linux/linux_c/strace-4.10‘

make[1]: Leaving directory `/home/linux/linux_c/strace-4.10‘

[email protected]:~/linux_c/strace-4.10$ file strace

strace: ELF 32-bit LSB executable, MIPS, MIPS32 rel2 version 1, dynamically linked (uses shared libs), with unknown capability 0xf41 = 0x756e6700, with unknown capability 0x70100 = 0x3040000, not stripped

默认make生成的是动态的

tu:~/linux_c/strace-4.10$ make CFLAGS+=-static

[email protected]:~/linux_c/strace-4.10$ file strace

strace: ELF 32-bit LSB executable, MIPS, MIPS32 rel2 version 1, statically linked, with unknown capability 0xf41 = 0x756e6700, with unknown capability 0x70100 = 0x3040000, not stripped

[email protected]:~/linux_c/strace-4.10$ cd ../

[email protected]:~/linux_c$ ls -lh

total 3.0M

-rwxrwxr-x  1 linux linux 6.8K Aug 14 16:51 a.out

-rwxrwxr-x  1 linux linux  928 Aug 14 16:57 cident.sh

-rwxrwxr-x  1 linux linux  474 Aug 14 16:57 makefile

-rwxrwxr-x  1 linux linux 1.3M Aug 14 17:10 strace

drwxr-xr-x 11 linux linux  12K Aug 14 17:08 strace-4.10

-rw-rw-r--  1 linux linux 588K Aug 14 16:18 strace-4.10.tar.xz

-rwxrwxr-x  1 linux linux 1.1M Aug 14 17:08 strace.dyn

-rw-rw-r--  1 linux linux   89 Aug 14 16:01 test.c

生成strace静态可执行文件,1.3MB多

Mafile 无法识别到mipsel-openwrt-linux-gcc目录,

修改PATH,从/etc/envimont

改到 ~/.bashrc

/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/home/linux/app/OpenWrt-Toolchain-ramips-for-mipsel_24kec+dsp-gcc-4.8-linaro_uClibc-0.9.33.2/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/bin

[email protected]:~/linux_c$which mipsel-openwrt-linux-gcc

/home/linux/app/OpenWrt-Toolchain-ramips-for-mipsel_24kec+dsp-gcc-4.8-linaro_uClibc-0.9.33.2/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/bin/mipsel-openwrt-linux-gcc

:~/linux_c$ make

mipsel-openwrt-linux-gcc  -o app.elf test.c -g -lpthread -ldl -Wall -Wimplicit-function-declaration

mipsel-openwrt-linux-uclibc-gcc.bin:warning: environment variable ‘STAGING_DIR‘ not defined

mipsel-openwrt-linux-uclibc-gcc.bin:warning: environment variable ‘STAGING_DIR‘ not defined

mipsel-openwrt-linux-uclibc-gcc.bin:warning: environment variable ‘STAGING_DIR‘ not defined

[email protected]:~/linux_c$file app.elf

app.elf: ELF 32-bitLSB executable, MIPS, MIPS32 rel2 version 1, dynamically linked (uses sharedlibs), with unknown capability 0xf41 = 0x756e6700, with unknown capability0x70100 = 0x3040000, not stripped

版权声明:本文为博主原创文章,未经博主允许不得转载。

时间: 2024-07-29 16:29:41

我的openwrt学习笔记(十九):linux便捷开发命令之strace的相关文章

angular学习笔记(十九)

本篇主要介绍angular使用指令修改DOM: 使用angular指令可以自己扩展html语法,还可以做很多自定义的事情.在后面会专门讲解这一块的知识,这一篇只是起到了解入门的作用. 与控制器,过滤器,服务,一样,可以通过模块实例的directive的方法来创建指令: var someModule = angular.module('SomeModule',[]); someModule.directive('directiveName',function(){ return { link: f

Linux学习笔记十:Linux用户管理

本笔记说的Linux用户管理主要包括以下内容: 1.用户配置文件(/etc/passwd  /etc/shadow) 2.组配置文件(/etc/group  /etc/gshadow) 3.用户缺省配置文件(/etc/login.defs  /etc/default/useradd) 4./etc/motd文件./etc/issue文件 5.SetUID权限.SetGID权限.黏着位 6.典型案例之一:手动创建一个用户 7.典型案例之二:批量添加用户 8.典型案例之三:限制用户使用su 9.典型

我的openwrt学习笔记(十八):linux便捷开发命令之alias

学习linux命令的是LINUX 的基础,相信很多人N多年前就知道这个命令,学习额时候也用过它,但是久而久之这个命令就淡出了我们的视野!在实际的工作中有时候会遗忘它,终其主要原因是字实际应用中运用的不够多! Linux命令:alias 功能说明:设置指令的别名. 语 法:alias[别名]=[指令名称] 补充说明:用户可利用alias,自定指令的别名.若仅输入alias,则可列出目前所有的别名设置. alias的效力仅及于该次登入的操作.若要每次登入是即自动设好别名,可在~/.bashrc中设定

Linux学习笔记&lt;十九&gt;——系统裁剪之一

grub-->kernel-->initrd-->ROOTFS(/sbin/init, /bin/bash) 自行在一块新硬盘上组建一个简单的Linux系统,具有/sbin/init初始化,能够使用/bin/bash 1.磁盘分区:只创建boot分区mount到/mnt/boot和根分区mount到/mnt/sysroot 2.cp /boot/vmlinuz-`uname -r` /mnt/boot/vmlinuz 3.grub-install --root-directory=/mn

[傅里叶变换及其应用学习笔记] 十九. 采样定理在音乐上的应用

采样定理在音乐上的应用 人可以听到20~20000Hz的声音,上限为20000Hz,即$\frac{p}{2} = 20000$,$p=40000$.那么采样率至少要为40000.CD的采样率采用44100(44.1kHz),据传,在采集模拟信号时采用44100,是因为这些采集的机器以该采样率设置时最为正常,而并非出于理论上的考虑. 在采样时,若采用低于40000的采样率,就会造成声音的高频部分混叠(alias),也有人把这个说成是“低频混叠了变为高频部分,而高频的部分被混叠为低频部分”,实际上

Android学习笔记十九.使用ContentProvider实现数据共享(一)

一.Android如何实现数据共享?  为了在应用程序之间交换数据,Android提供了ContentProvider,ContentProvider是不同应用程序之间进行数据交换的标准API,当一个应用程序需要把自己的数据暴露给其他程序使用时,该应用程序就可通过提供ContentProvider来实现,其他的应用程序就可以通过ContentResolver来操作ContentProvider暴露的数据.一旦某个应用程序通过ContentProvider暴露了自己的数据操作接口,那么不管该应用程

Java基础学习笔记十九 IO

File IO概述 回想之前写过的程序,数据都是在内存中,一旦程序运行结束,这些数据都没有了,等下次再想使用这些数据,可是已经没有了.那怎么办呢?能不能把运算完的数据都保存下来,下次程序启动的时候,再把这些数据读出来继续使用呢?其实要把数据持久化存储,就需要把内存中的数据存储到内存以外的其他持久化设备(硬盘.光盘.U盘等)上. 当需要把内存中的数据存储到持久化设备上这个动作称为输出(写)Output操作.当把持久设备上的数据读取到内存中的这个动作称为输入(读)Input操作.因此我们把这种输入和

JSTL 标签库 使用(web基础学习笔记十九)

标签库概要: 一.C标签库介绍 1.1.<c:> 核心标签库  JSTL 核心标签库(C标签)标签共有13个,功能上分为4类:1.表达式控制标签:out.set.remove.catch2.流程控制标签:if.choose.when.otherwise3.循环标签:forEach.forTokens4.URL操作标签:import.url.redirect 二.表达式控制标签 2.1.out标签 <c:out value="" escapeXml="&quo

yii2源码学习笔记(十九)

view剩余代码 1 /** 2 * @return string|boolean the view file currently being rendered. False if no view file is being rendered. 3 * 当前正在渲染的视图文件 4 */ 5 public function getViewFile() 6 { 7 return end($this->_viewFiles); 8 } 9 10 /** 11 * This method is invo